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

pub enum SyntaxExtension {
    MultiDecorator(Box<MultiItemDecorator>),
    MultiModifier(Box<MultiItemModifier>),
    ProcMacro(Box<ProcMacro>),
    AttrProcMacro(Box<AttrProcMacro>),
    NormalTT(Box<TTMacroExpander>, Option<Span>, bool),
    IdentTT(Box<IdentMacroExpander>, Option<Span>, bool),
    CustomDerive(Box<MultiItemModifier>),
}

An enum representing the different kinds of syntax extensions.

Variants

MultiDecorator(Box<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<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<ProcMacro>)

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

AttrProcMacro(Box<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<TTMacroExpander>, Option<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<IdentMacroExpander>, Option<Span>, bool)

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

CustomDerive(Box<MultiItemModifier>)