use crate::ir::{IrCompile, IrError, IrEval};
use crate::macros::{current_context, ToTokens, TokenStream};
use crate::parsing::{ResolveError, ResolveOwned};
use crate::Spanned;
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 resolve<T>(item: T) -> Result<T::Owned, ResolveError>
where
T: ResolveOwned,
{
current_context(|ctx| ctx.resolve_owned(item))
}
pub fn to_tokens<T>(tokens: &T, stream: &mut TokenStream)
where
T: ToTokens,
{
current_context(|ctx| tokens.to_tokens(ctx, stream))
}
pub fn stringify<T>(stream: &T) -> String
where
T: ToTokens,
{
current_context(|ctx| ctx.stringify(stream).to_string())
}