Enum OneOrMany

Source
pub enum OneOrMany<TOne, TMany> {
    One(TOne),
    Many(TMany),
}
Expand description

Matches one of two FromMacro implementors by count.

Variants§

§

One(TOne)

§

Many(TMany)

Trait Implementations§

Source§

impl<TOne: Debug, TMany: Debug> Debug for OneOrMany<TOne, TMany>

Source§

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

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

impl<TOne, TMany> FromMacro for OneOrMany<TOne, TMany>
where TOne: FromMacro, TMany: FromMacro,

Source§

fn from_one(tt: TokenTree) -> Result<Self, Error>

This will be called if there is only one item
Source§

fn from_many(tokens: TokenStream) -> Result<Self, Error>

This will be called if there is more than one item. Read more
Source§

const PREFER_MANY: bool = false

Hint to All and similar extractors to disable length validation. Read more
Source§

fn peek(tt: &TokenTree) -> bool

Look ahead and determine parsability. Read more

Auto Trait Implementations§

§

impl<TOne, TMany> Freeze for OneOrMany<TOne, TMany>
where TOne: Freeze, TMany: Freeze,

§

impl<TOne, TMany> RefUnwindSafe for OneOrMany<TOne, TMany>
where TOne: RefUnwindSafe, TMany: RefUnwindSafe,

§

impl<TOne, TMany> Send for OneOrMany<TOne, TMany>
where TOne: Send, TMany: Send,

§

impl<TOne, TMany> Sync for OneOrMany<TOne, TMany>
where TOne: Sync, TMany: Sync,

§

impl<TOne, TMany> Unpin for OneOrMany<TOne, TMany>
where TOne: Unpin, TMany: Unpin,

§

impl<TOne, TMany> UnwindSafe for OneOrMany<TOne, TMany>
where TOne: UnwindSafe, TMany: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> Extractor for T
where T: FromMacro,

Source§

fn extract(iter: &mut impl Iterator<Item = TokenTree>) -> Result<T, Error>

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.