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§

source

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.

source

type Metadata

The metadata of an argument or an attribute.

Required Methods§

source

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.

source

fn validate( state: ArgResult<Self::InitialType>, arg_name: &'static str ) -> Result<Self, Vec<Error, Global>>

Converts the initial type to Self or returns found errors.
If the argument is required it should return a missing error.
Wrapper types such as Option can overwrite this.

Implementations on Foreign Types§

source§

impl<V> TryFromMeta<V> for u32where V: SynVersion,

source§

impl<V> TryFromMeta<V> for u8where V: SynVersion,

source§

impl<V> TryFromMeta<V> for Stringwhere V: SynVersion,

source§

impl<V> TryFromMeta<V> for u128where V: SynVersion,

source§

impl<V> TryFromMeta<V> for u64where V: SynVersion,

source§

impl<V> TryFromMeta<V> for i16where V: SynVersion,

source§

impl<V> TryFromMeta<V> for i8where V: SynVersion,

source§

impl<V> TryFromMeta<V> for f32where V: SynVersion,

source§

impl<V> TryFromMeta<V> for f64where V: SynVersion,

source§

impl<V> TryFromMeta<V> for i64where V: SynVersion,

source§

impl<V> TryFromMeta<V> for boolwhere V: SynVersion,

source§

impl<V> TryFromMeta<V> for i128where V: SynVersion,

source§

impl<V, T> TryFromMeta<V> for Option<T>where V: SynVersion, T: TryFromMeta<V>,

§

type InitialType = <T as TryFromMeta<V>>::InitialType

§

type Metadata = <T as TryFromMeta<V>>::Metadata

source§

fn try_from_meta( meta: <Option<T> as TryFromMeta<V>>::Metadata ) -> ArgResult<<Option<T> as TryFromMeta<V>>::InitialType>

source§

fn validate( state: ArgResult<<Option<T> as TryFromMeta<V>>::InitialType>, arg_name: &'static str ) -> Result<Option<T>, Vec<Error, Global>>

source§

impl<V, T> TryFromMeta<V> for Vec<T, Global>where V: SynVersion, T: TryFromMeta<V, Metadata = <V as SynVersion>::ArgMeta>,

source§

impl<V> TryFromMeta<V> for i32where V: SynVersion,

source§

impl<V> TryFromMeta<V> for u16where V: SynVersion,

Implementors§