Trait derive_attribute::TryFromMeta
source · pub trait TryFromMeta<V>: Sizedwhere
V: SynVersion,{
type InitialType: Concat;
type Metadata;
// Required methods
fn try_from_meta(meta: Self::Metadata) -> ArgResult<Self::InitialType>;
fn validate(
state: ArgResult<Self::InitialType>,
arg_name: &'static str
) -> Result<Self, Vec<Error, Global>>;
}Expand description
A trait for deserializing Syn metadata.
Its recommended that you use the CustomArgFromMeta trait for deserializing simple arguments.
Required Associated Types§
sourcetype InitialType: Concat
type InitialType: Concat
This is the initial type and will be converted to Self in the validate function.
For most types this is typically Self but for lists this is a builder.
Required Methods§
sourcefn try_from_meta(meta: Self::Metadata) -> ArgResult<Self::InitialType>
fn try_from_meta(meta: Self::Metadata) -> ArgResult<Self::InitialType>
Looks for values & errors in the metadata.
The returned result is added to the argument’s state using the
concat method on ArgResult which in turn will call the initial type’s Concat implementation if found.