use crate::rstd::inject::*; use super::*; struct TracedInject; impl<'a, Ctx: Context<'a, _Tm = TracedInstance>> Inject<'a, Ctx> for TracedInject { fn inject(&self, fa: Wrapped<'a, Ctx, A>) -> Wrapped<'a, Ctx, A> { fa.after_resolution() } } /// Extension trait to trace the evaluation flow. pub trait Traceable<'a, Ctx: Context<'a, _Tm = TracedInstance>>: Mentionable<'a, Ctx> + Sized { /// Re-cast the value, adding an extra[^extra] /// note ([`RenderedCommon::Resolution`]) to the trace on each resolution. /// /// [^extra]: applying [`Traceable::trace`] multiple times /// might affect the trace in undesireable ways fn trace(&self) -> ParseResultA<'a, Ctx, Self> { Rc::new(TracedInject).inject_mentionable(self) } } impl<'a, Ctx: Context<'a, _Tm = TracedInstance>, A: Mentionable<'a, Ctx>> Traceable<'a, Ctx> for A {}