pub struct AnonScope(/* private fields */);Expand description
A Scope plus field values
This supports dereference to a Scope, allowing macro expansion via
Scope::apply_attrs and other manipulation.
Tokens may be generated by Self::expand.
Implementations§
Source§impl AnonScope
impl AnonScope
Sourcepub fn expand(self) -> TokenStream
pub fn expand(self) -> TokenStream
Generate the TokenStream
This is a convenience function. It is valid to, instead, (1) call
Scope::expand_impl_self on self, then (2) use the ToTokens
impl on Scope.
Methods from Deref<Target = Scope>§
Sourcepub fn apply_attrs(
&mut self,
find_rule: impl Fn(&Path) -> Option<&'static dyn ScopeAttr>,
)
pub fn apply_attrs( &mut self, find_rule: impl Fn(&Path) -> Option<&'static dyn ScopeAttr>, )
Apply attribute rules
The supplied rules are applied in the order of definition, and their
attributes removed from the item.
Sourcepub fn expand_impl_self(&mut self)
pub fn expand_impl_self(&mut self)
Expand impl Self
This is done automatically by Self::expand. It may be called earlier
by a ScopeAttr if required. Calling multiple times is harmless.
Trait Implementations§
Source§impl ToTokens for AnonScope
impl ToTokens for AnonScope
Source§fn to_tokens(&self, tokens: &mut TokenStream)
fn to_tokens(&self, tokens: &mut TokenStream)
Source§fn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
Source§fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
Auto Trait Implementations§
impl !Send for AnonScope
impl !Sync for AnonScope
impl Freeze for AnonScope
impl RefUnwindSafe for AnonScope
impl Unpin for AnonScope
impl UnsafeUnpin for AnonScope
impl UnwindSafe for AnonScope
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Spanned for Twhere
T: Spanned + ?Sized,
impl<T> Spanned for Twhere
T: Spanned + ?Sized,
Source§fn span(&self) -> Span
fn span(&self) -> Span
Returns a
Span covering the complete contents of this syntax tree
node, or Span::call_site() if this node is empty.