Struct impl_tools_lib::SingletonScope
source · pub struct SingletonScope(_, _);
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 SingletonScope
impl SingletonScope
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 Debug for SingletonScope
impl Debug for SingletonScope
source§impl Deref for SingletonScope
impl Deref for SingletonScope
source§impl DerefMut for SingletonScope
impl DerefMut for SingletonScope
source§impl ToTokens for SingletonScope
impl ToTokens for SingletonScope
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 RefUnwindSafe for SingletonScope
impl !Send for SingletonScope
impl !Sync for SingletonScope
impl Unpin for SingletonScope
impl UnwindSafe for SingletonScope
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.