pub fn eval<T>(target: &T) -> Result<<T::Output as IrEval>::Output, IrError>
where
    T: Spanned + IrCompile,
    T::Output: IrEval,
{
    current_context(|ctx| ctx.eval(target))
}
/// Evaluate the given target as a constant expression.
///
/// # Panics
///
/// This will panic if it's called outside of a macro context.
///
/// # Examples
///
/// ```rust
/// use rune::{macros, ast, IrValue, MacroContext};
///
/// // Note: should only be used for testing.
/// let ctx = MacroContext::empty();
///
/// macros::with_context(ctx, || {
///     let stream = rune::quote!(1 + 2).into_token_stream();
///
///     let mut p = rune::Parser::from_token_stream(&stream);
///     let expr = p.parse_all::<ast::Expr>().unwrap();
///     let value = macros::eval(&expr).unwrap();
///
///     assert_eq!(3, value.into_integer::<u32>().unwrap());
/// });
/// ```
Evaluate the given target as a constant expression.
Evaluate the given target as a constant expression .
pub fn eval<T>(target: &T) -> Result<<T::Output as IrEval>::Output, IrError>
where
    T: Spanned + IrCompile,
    T::Output: IrEval,
{
    current_context(|ctx| ctx.eval(target))
}
pub fn eval < T > ( target : & T ) -> Result < < T :: Output as IrEval > :: Output , IrError > where T : Spanned + IrCompile , T :: Output : IrEval , { current_context ( | ctx | ctx . eval ( target ) ) }
Evaluate the given target as a constant expression.
Evaluate the given target as a constant expression .
target
&T
target
&T
panics
This will panic if it's called outside of a macro context.
This will panic if it ' s called outside of a macro context .
examples
```rust
use rune::{macros, ast, IrValue, MacroContext}.

should only be used for testing.
let ctx = MacroContext::empty().

:with_context(ctx, || {
let stream = rune::quote!(1 + 2).into_token_stream().

let mut p = rune::Parser::from_token_stream(&stream);
let expr = p.parse_all::().unwrap();
let value = macros::eval(&expr).unwrap().


` ` ` rust use rune :: { macros ast IrValue MacroContext } . should only be used for testing . let ctx = MacroContext :: empty () . : with_context ( ctx || { let stream = rune :: quote! ( 1 + 2 ) . into_token_stream () . let mut p = rune :: Parser :: from_token_stream ( &stream ) ; let expr = p . parse_all :: () . unwrap () ; let value = macros :: eval ( &expr ) . unwrap () .