pub trait TryFromMeta<V: SynVersion>: Sized {
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>>;
}
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.
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.