[−][src]Attribute Macro call_trace_macro::trace_with
#[trace_with]
The #[trace_with]
macro. Needs to be applied to function definitions,
and will call a user-provided expression with the function body wrapped
in a closure, and a CallContext
parameter.
The attribute accepts additional expression arguments that will be inserted after the context paramter.
Example
use call_trace::{trace_with, CallContext};
impl MyType {
#[trace_with(self.trace())]
fn foo(&mut self) {
// ...
}
fn trace<T, F: FnOnce() -> T>(&mut self) -> impl FnOnce(F, CallContext) -> T {
|f, _ctx| {
f()
}
}
}