[−][src]Enum syntax::ext::base::SyntaxExtension
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<dyn 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<dyn 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
AttrProcMacro(Box<dyn 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<dyn TTMacroExpander + Sync + Send>
def_info: Option<(NodeId, Span)>
allow_internal_unstable: bool
Whether the contents of the macro can
directly use #[unstable]
things (true == yes).
allow_internal_unsafe: bool
Whether the contents of the macro can use unsafe
without triggering the unsafe_code
lint.
local_inner_macros: bool
Enables the macro helper hack (ident!(...)
-> $crate::ident!(...)
)
for a given macro.
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<dyn IdentMacroExpander + Sync + Send>, Option<Span>, bool)
A function-like syntax extension that has an extra ident before the block.
ProcMacroDerive(Box<dyn 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
Methods
impl SyntaxExtension
[src]
impl SyntaxExtension
pub fn kind(&self) -> MacroKind | [src] |
Return which kind of macro calls this syntax extension.
pub fn default_transparency(&self) -> Transparency | [src] |
pub fn edition(&self) -> Edition | [src] |
Auto Trait Implementations
impl !Send for SyntaxExtension
impl !Send for SyntaxExtension
impl !Sync for SyntaxExtension
impl !Sync for SyntaxExtension
Blanket Implementations
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> | [src] |
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId | [src] |
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T | [src] |
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error> | [src] |
impl<E> SpecializationError for E
[src]
impl<E> SpecializationError for E
impl<T> Erased for T
[src]
impl<T> Erased for T
impl<T> Send for T where
T: ?Sized,
[src]
impl<T> Send for T where
T: ?Sized,
impl<T> Sync for T where
T: ?Sized,
[src]
impl<T> Sync for T where
T: ?Sized,
impl<T> Erased for T
impl<T> Erased for T