[−][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: Option<Lrc<[Symbol]>>
Whether the contents of the macro can
directly use #[unstable]
things.
Only allows things that require a feature gate in the given whitelist
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
A function-like syntax extension that has an extra ident before the block.
Fields of IdentTT
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]
pub fn kind(&self) -> MacroKind
[src]
Returns 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 !Sync for SyntaxExtension
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom 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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto 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<E> SpecializationError for E
[src]
default fn not_found<S, T>(
trait_name: &'static str,
method_name: &'static str
) -> E where
T: ?Sized,
[src]
trait_name: &'static str,
method_name: &'static str
) -> E where
T: ?Sized,
impl<T> Send for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Sync for T where
T: ?Sized,
[src]
T: ?Sized,