pub struct ProcMacroEnv<'a> { /* private fields */ }Expand description
The ProcMacroEnv struct is the root of the proc macro environment. It defines the Path structure that is used for calling functions
Implementations§
Source§impl<'a> ProcMacroEnv<'a>
impl<'a> ProcMacroEnv<'a>
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new proc macro environement. This would usually be called only once per proc macro definition.
Sourcepub fn add_path(&mut self, ident: &str, path: Path<'a>)
pub fn add_path(&mut self, ident: &str, path: Path<'a>)
Adds a path to the root of the proc macro environment.
§Panics
This method will panic if the same identifier is added twice or the identifier is invalid.
Sourcepub fn process(&self, tokens: TokenStream) -> TokenStream
pub fn process(&self, tokens: TokenStream) -> TokenStream
Process the provided TokenSteam. On success, this will return a TokenSteam that defines a set of constants. On failure, a compile time error will be reported.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for ProcMacroEnv<'a>
impl<'a> !RefUnwindSafe for ProcMacroEnv<'a>
impl<'a> !Send for ProcMacroEnv<'a>
impl<'a> !Sync for ProcMacroEnv<'a>
impl<'a> Unpin for ProcMacroEnv<'a>
impl<'a> !UnwindSafe for ProcMacroEnv<'a>
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