TemplateElement

Enum TemplateElement 

Source
pub enum TemplateElement<O: SubstParseContext> {
    Ident(Ident, O::NotInConcat),
    LitStr(LitStr),
    Literal(Lit, (<O as SubstParseContext>::NotInPaste, <O as SubstParseContext>::NotInConcat)),
    Punct(Punct, (<O as SubstParseContext>::NotInPaste, <O as SubstParseContext>::NotInConcat)),
    Group {
        delim_span: Span,
        delimiter: Delimiter,
        template: Template<O>,
        allow_tokens: (<O as SubstParseContext>::NotInPaste, <O as SubstParseContext>::NotInConcat),
    },
    Subst(Subst<O>),
    Repeat(RepeatedTemplate<O>),
}

Variants§

§

Ident(Ident, O::NotInConcat)

§

LitStr(LitStr)

§

Literal(Lit, (<O as SubstParseContext>::NotInPaste, <O as SubstParseContext>::NotInConcat))

Not used for syn::Lit::Str

§

Punct(Punct, (<O as SubstParseContext>::NotInPaste, <O as SubstParseContext>::NotInConcat))

§

Group

Fields

§delim_span: Span

Sadly Group’s constructors let us only set both delimiters

§delimiter: Delimiter
§template: Template<O>
§

Subst(Subst<O>)

Might contain SD::when

§

Repeat(RepeatedTemplate<O>)

Trait Implementations§

Source§

impl<O: SubstParseContext> AnalyseRepeat for TemplateElement<O>

Source§

impl<O: Debug + SubstParseContext> Debug for TemplateElement<O>
where O::NotInConcat: Debug,

Source§

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

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

impl Expand<Accumulator> for TemplateElement<Accumulator>

Source§

fn expand<'c>( &self, ctx: GeneralContext<'c>, out: &mut Accumulator, ) -> Result<()>

Source§

impl Expand<Items> for TemplateElement<Items>

Source§

fn expand<'c>(&self, ctx: GeneralContext<'c>, out: &mut Items) -> Result<()>

Source§

impl Expand<TokenAccumulator> for TemplateElement<TokenAccumulator>

Source§

fn expand<'c>( &self, ctx: GeneralContext<'c>, out: &mut TokenAccumulator, ) -> Result<()>

Source§

impl<O: SubstParseContext> FindRecogMetas for TemplateElement<O>

Source§

fn find_recog_metas(&self, acc: &mut Recognised)

Search for fmeta(..) etc. expansions Read more
Source§

impl<O: SubstParseContext> Parse for TemplateElement<O>

Source§

fn parse(input: ParseStream<'_>) -> Result<Self>

Auto Trait Implementations§

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.