[−][src]Enum syntex_syntax2::ext::base::SyntaxExtension
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
impl !Sync for SyntaxExtension
impl Unpin for SyntaxExtension
impl !Send for SyntaxExtension
impl !UnwindSafe for SyntaxExtension
impl !RefUnwindSafe for SyntaxExtension
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
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, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,