pub struct MacroCx<'a> { /* private fields */ }Expand description
Expansion context passed to macros: the evaluation context, current phase, environment, expansion budget, and the active macro stack.
Implementations§
Source§impl<'a> MacroCx<'a>
impl<'a> MacroCx<'a>
Sourcepub fn new(cx: &'a mut Cx, phase: Phase) -> Self
pub fn new(cx: &'a mut Cx, phase: Phase) -> Self
Creates an expansion context with the default expansion limits.
Sourcepub fn with_limits(
cx: &'a mut Cx,
phase: Phase,
limits: MacroExpansionLimits,
) -> Self
pub fn with_limits( cx: &'a mut Cx, phase: Phase, limits: MacroExpansionLimits, ) -> Self
Creates an expansion context with explicit expansion limits.
Sourcepub fn quote_expr(&self, expr: Expr) -> Result<Value>
pub fn quote_expr(&self, expr: Expr) -> Result<Value>
Quotes an expression into a value through the factory.
Sourcepub fn hygienic_symbol(&mut self, prefix: impl AsRef<str>) -> Symbol
pub fn hygienic_symbol(&mut self, prefix: impl AsRef<str>) -> Symbol
Generates a fresh hygienic symbol scoped to the active macro.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for MacroCx<'a>
impl<'a> !UnwindSafe for MacroCx<'a>
impl<'a> Freeze for MacroCx<'a>
impl<'a> Send for MacroCx<'a>
impl<'a> Sync for MacroCx<'a>
impl<'a> Unpin for MacroCx<'a>
impl<'a> UnsafeUnpin for MacroCx<'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