pub struct CustomArg<T>(pub T);

Tuple Fields§

§0: T

Trait Implementations§

source§

impl<T> Concat for CustomArg<T>

source§

const NO_DUPLICATES: bool = true

Determines whether a duplicate is allowed or if an error should be thrown.
This logic is handled in the implementation for ArgResult.
Typically only true for primitive types.
source§

fn concat(&mut self, other: Self)

Combines an argument.
source§

impl<T: Debug> Debug for CustomArg<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: Default> Default for CustomArg<T>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<V: SynVersion, T: CustomArgFromMeta<V>> TryFromMeta<V> for CustomArg<T>

§

type InitialType = CustomArg<T>

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.
§

type Metadata = <V as SynVersion>::ArgMeta

The metadata of an argument or an attribute.
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>>

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.

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for CustomArg<T>where T: RefUnwindSafe,

§

impl<T> Send for CustomArg<T>where T: Send,

§

impl<T> Sync for CustomArg<T>where T: Sync,

§

impl<T> Unpin for CustomArg<T>where T: Unpin,

§

impl<T> UnwindSafe for CustomArg<T>where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.