pub enum MacArgs {
Empty,
Delimited(DelimSpan, MacDelimiter, TokenStream),
Eq(Span, MacArgsEq),
}
Expand description
Arguments passed to an attribute or a function-like macro.
Variants
Empty
No arguments - #[attr]
.
Delimited(DelimSpan, MacDelimiter, TokenStream)
Delimited arguments - #[attr()/[]/{}]
or mac!()/[]/{}
.
Eq(Span, MacArgsEq)
Arguments of a key-value attribute - #[attr = "value"]
.
Implementations
sourceimpl MacArgs
impl MacArgs
pub fn delim(&self) -> Option<Delimiter>
pub fn span(&self) -> Option<Span>
sourcepub fn inner_tokens(&self) -> TokenStream
pub fn inner_tokens(&self) -> TokenStream
Tokens inside the delimiters or after =
.
Proc macros see these tokens, for example.
sourcepub fn need_semicolon(&self) -> bool
pub fn need_semicolon(&self) -> bool
Whether a macro with these arguments needs a semicolon when used as a standalone item or statement.
Trait Implementations
sourceimpl<CTX> HashStable<CTX> for MacArgswhere
CTX: HashStableContext,
impl<CTX> HashStable<CTX> for MacArgswhere
CTX: HashStableContext,
fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher)
Auto Trait Implementations
impl !RefUnwindSafe for MacArgs
impl !Send for MacArgs
impl !Sync for MacArgs
impl Unpin for MacArgs
impl !UnwindSafe for MacArgs
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Layout
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 64 bytes
Size for each variant:
Empty
: 0 bytesDelimited
: 31 bytesEq
: 63 bytes