Enum syntax::ext::base::SyntaxExtension [−][src]
pub enum SyntaxExtension { NonMacroAttr { mark_used: bool, }, MultiDecorator(Box<MultiItemDecorator + Sync + Send>), MultiModifier(Box<MultiItemModifier + Sync + Send>), ProcMacro { expander: Box<ProcMacro + Sync + Send>, allow_internal_unstable: bool, edition: Edition, }, 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 { expander: Box<TTMacroExpander + Sync + Send>, def_info: Option<(NodeId, Span)>, is_transparent: bool, edition: Edition, }, }
An enum representing the different kinds of syntax extensions.
Variants
NonMacroAttr
A trivial "extension" that does nothing, only keeps the attribute and marks it as known.
Fields of NonMacroAttr
mark_used: bool |
MultiDecorator(Box<MultiItemDecorator + Sync + Send>)
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 + Sync + Send>)
A syntax extension that is attached to an item and modifies it in-place. Also allows decoration, i.e., creating new items.
ProcMacro
A function-like procedural macro. TokenStream -> TokenStream.
Fields of ProcMacro
expander: Box<ProcMacro + Sync + Send> | |
allow_internal_unstable: bool | |
edition: Edition |
AttrProcMacro(Box<AttrProcMacro + Sync + Send>, Edition)
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
A normal, function-like syntax extension.
bytes!
is a NormalTT
.
Fields of NormalTT
expander: Box<TTMacroExpander + Sync + Send> | |
def_info: Option<(NodeId, Span)> | |
allow_internal_unstable: bool | Whether the contents of the macro can
directly use |
allow_internal_unsafe: bool | Whether the contents of the macro can use |
local_inner_macros: bool | Enables the macro helper hack ( |
unstable_feature: Option<(Symbol, u32)> | The macro's feature name if it is unstable, and the stability feature |
edition: Edition | Edition of the crate in which the macro is defined |
IdentTT(Box<IdentMacroExpander + Sync + Send>, Option<Span>, bool)
A function-like syntax extension that has an extra ident before the block.
ProcMacroDerive(Box<MultiItemModifier + Sync + Send>, Vec<Symbol>, Edition)
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
A declarative macro, e.g. macro m() {}
.
Fields of DeclMacro
expander: Box<TTMacroExpander + Sync + Send> | |
def_info: Option<(NodeId, Span)> | |
is_transparent: bool | |
edition: Edition |
Methods
impl SyntaxExtension
[src]
impl SyntaxExtension
pub fn kind(&self) -> MacroKind
[src]
pub fn kind(&self) -> MacroKind
Return which kind of macro calls this syntax extension.
pub fn default_transparency(&self) -> Transparency
[src]
pub fn default_transparency(&self) -> Transparency
pub fn edition(&self) -> Edition
[src]
pub fn edition(&self) -> Edition
Auto Trait Implementations
impl !Send for SyntaxExtension
impl !Send for SyntaxExtension
impl !Sync for SyntaxExtension
impl !Sync for SyntaxExtension