[][src]Attribute Macro call_trace_macro::inject_with

#[inject_with]

The #[inject_with] macro. Needs to be applied to function definitions, and will call a user-provided expression with the function body wrapped in a closure.

The attribute accepts additional expression arguments that will be passed to the user-provided function as extra arguments.

Example

use call_trace::inject_with;

impl MyType {
    #[inject_with(self.trace())]
    fn foo(&mut self) {
        // ...
    }

    fn trace<T, F: FnOnce() -> T>(&mut self) -> impl FnOnce(F) -> T {
        |f| {
            f()
        }
    }
}