use call_trace::{trace_with, CallContext, Trace};
struct My;
impl My {
#[inline]
#[trace_with(self)]
fn foo(&mut self) {
self.bar();
}
#[trace_with(self)]
fn bar(&mut self) {
let x = self.baz();
let y = self.baz();
println!("x + y = {}", x + y);
}
#[trace_with(self)]
fn baz(&mut self) -> i32 {
15
}
}
impl Trace for My {
fn on_pre(&mut self, ctx: &CallContext) {
println!("> {:?}", ctx);
}
fn on_post(&mut self, ctx: &CallContext) {
println!("< {:?}", ctx);
}
}
#[test]
fn test() {
My.foo();
}