[][src]Enum syntex_syntax2::ext::base::SyntaxExtension

pub enum SyntaxExtension {
    MultiDecorator(Box<dyn MultiItemDecorator>),
    MultiModifier(Box<dyn MultiItemModifier>),
    ProcMacro(Box<dyn ProcMacro>),
    AttrProcMacro(Box<dyn AttrProcMacro>),
    NormalTT(Box<dyn TTMacroExpander>, Option<(NodeId, Span)>, bool),
    IdentTT(Box<dyn IdentMacroExpander>, Option<Span>, bool),
    ProcMacroDerive(Box<dyn MultiItemModifier>, Vec<Symbol>),
    BuiltinDerive(BuiltinDeriveFn),
    DeclMacro(Box<dyn TTMacroExpander>, Option<Span>),
}

An enum representing the different kinds of syntax extensions.

Variants

MultiDecorator(Box<dyn MultiItemDecorator>)

A syntax extension that is attached to an item and creates new items based upon it.

#[derive(...)] is a MultiItemDecorator.

Prefer ProcMacro or MultiModifier since they are more flexible.

MultiModifier(Box<dyn MultiItemModifier>)

A syntax extension that is attached to an item and modifies it in-place. Also allows decoration, i.e., creating new items.

ProcMacro(Box<dyn ProcMacro>)

A function-like procedural macro. TokenStream -> TokenStream.

AttrProcMacro(Box<dyn AttrProcMacro>)

An attribute-like procedural macro. TokenStream, TokenStream -> TokenStream. The first TokenSteam is the attribute, the second is the annotated item. Allows modification of the input items and adding new items, similar to MultiModifier, but uses TokenStreams, rather than AST nodes.

NormalTT(Box<dyn TTMacroExpander>, Option<(NodeId, Span)>, bool)

A normal, function-like syntax extension.

bytes! is a NormalTT.

The bool dictates whether the contents of the macro can directly use #[unstable] things (true == yes).

IdentTT(Box<dyn IdentMacroExpander>, Option<Span>, bool)

A function-like syntax extension that has an extra ident before the block.

ProcMacroDerive(Box<dyn MultiItemModifier>, Vec<Symbol>)

An attribute-like procedural macro. TokenStream -> TokenStream. The input is the annotated item. Allows generating code to implement a Trait for a given struct or enum item.

BuiltinDerive(BuiltinDeriveFn)

An attribute-like procedural macro that derives a builtin trait.

DeclMacro(Box<dyn TTMacroExpander>, Option<Span>)

A declarative macro, e.g. macro m() {}.

Methods

impl SyntaxExtension[src]

pub fn kind(&self) -> MacroKind[src]

Return which kind of macro calls this syntax extension.

pub fn is_modern(&self) -> bool[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]