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

pub enum SyntaxExtension {
    MultiDecorator(Box<MultiItemDecorator + Sync + Send>),
    MultiModifier(Box<MultiItemModifier + Sync + Send>),
    ProcMacro(Box<ProcMacro + Sync + Send>, boolEdition),
    AttrProcMacro(Box<AttrProcMacro + Sync + Send>, Edition),
    NormalTT {
        expander: Box<TTMacroExpander + Sync + Send>,
        def_info: Option<(NodeId, Span)>,
        allow_internal_unstable: bool,
        allow_internal_unsafe: bool,
        local_inner_macros: bool,
        unstable_feature: Option<(Symbol, u32)>,
        edition: Edition,
    },
    IdentTT(Box<IdentMacroExpander + Sync + Send>, Option<Span>, bool),
    ProcMacroDerive(Box<MultiItemModifier + Sync + Send>, Vec<Symbol>, Edition),
    BuiltinDerive(BuiltinDeriveFn),
    DeclMacro(Box<TTMacroExpander + Sync + Send>, Option<(NodeId, Span)>, Edition),
}

An enum representing the different kinds of syntax extensions.

Variants

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.

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

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

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.

A normal, function-like syntax extension.

bytes! is a NormalTT.

Fields of NormalTT

Whether the contents of the macro can directly use #[unstable] things (true == yes).

Whether the contents of the macro can use unsafe without triggering the unsafe_code lint.

Enables the macro helper hack (ident!(...) -> $crate::ident!(...)) for a given macro.

The macro's feature name if it is unstable, and the stability feature

Edition of the crate in which the macro is defined

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

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.

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

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

The second element is the definition site span.

Methods

impl SyntaxExtension
[src]

Return which kind of macro calls this syntax extension.

Auto Trait Implementations