Function rune::with_context[][src]

pub fn with_context<F, O>(new: MacroContext, f: F) -> O where
    F: FnOnce() -> O, 
Expand description

Install the given context and call the provided function with the installed context.

Panics

This will panic if called while the current context is in use.

Examples

use rune::macros::{with_context, MacroContext};
let ctx = MacroContext::empty();

with_context(ctx, || {
    rune::quote!(hello self);
});