pub trait FromDeriveInput: Sized {
// Provided methods
fn from_derive_input(input: &DeriveInput) -> Result<Self> { ... }
fn from_union(
attrs: &Vec<Attribute>,
vis: &Visibility,
ident: &Ident,
generics: &Generics,
input: &DataUnion,
) -> Result<Self> { ... }
fn from_enum(
attrs: &Vec<Attribute>,
vis: &Visibility,
ident: &Ident,
generics: &Generics,
input: &DataEnum,
) -> Result<Self> { ... }
fn from_struct(
attrs: &Vec<Attribute>,
vis: &Visibility,
ident: &Ident,
generics: &Generics,
input: &DataStruct,
) -> Result<Self> { ... }
fn parse(input: TokenStream) -> Result<Self> { ... }
}Expand description
Creates an instance by parsing an entire proc-macro derive input,
including the, identity, generics, and visibility of the type.
This trait should either be derived or manually implemented by a type
in the proc macro crate which is directly using darling. It is unlikely
that these implementations will be reusable across crates.
Provided Methods§
Sourcefn from_derive_input(input: &DeriveInput) -> Result<Self>
fn from_derive_input(input: &DeriveInput) -> Result<Self>
Create an instance from syn::DeriveInput, or return an error.
fn from_union( attrs: &Vec<Attribute>, vis: &Visibility, ident: &Ident, generics: &Generics, input: &DataUnion, ) -> Result<Self>
fn from_enum( attrs: &Vec<Attribute>, vis: &Visibility, ident: &Ident, generics: &Generics, input: &DataEnum, ) -> Result<Self>
fn from_struct( attrs: &Vec<Attribute>, vis: &Visibility, ident: &Ident, generics: &Generics, input: &DataStruct, ) -> Result<Self>
fn parse(input: TokenStream) -> Result<Self>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.