Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/C/Firefox/third_party/rust/darling_core/src/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 781 B image not shown  

Quelle  from_field.rs   Sprache: unbekannt

 
use syn::Field;

use crate::Result;

/// Creates an instance by parsing an individual field and its attributes.
pub trait FromField: Sized {
    fn from_field(field: &Field) -> Result<Self>;
}

impl FromField for () {
    fn from_field(_: &Field) -> Result<Self> {
        Ok(())
    }
}

impl FromField for Field {
    fn from_field(field: &Field) -> Result<Self> {
        Ok(field.clone())
    }
}

impl FromField for syn::Type {
    fn from_field(field: &Field) -> Result<Self> {
        Ok(field.ty.clone())
    }
}

impl FromField for syn::Visibility {
    fn from_field(field: &Field) -> Result<Self> {
        Ok(field.vis.clone())
    }
}

impl FromField for Vec<syn::Attribute> {
    fn from_field(field: &Field) -> Result<Self> {
        Ok(field.attrs.clone())
    }
}

[ Dauer der Verarbeitung: 0.20 Sekunden  (vorverarbeitet)  ]