pub fn trace_block<T, F>(f: F) -> Box<dyn FnOnce() -> T + Send>Expand description
Optionally instruments a blocking closure with custom tracing.
If a tracer has been injected via set_tracer, the closure is wrapped so that
its return value is boxed (erasing its type), passed to the tracer, and then the
result is downcast back to the original type. If no tracer is set, the closure is
returned unmodified (except for being boxed).
§Type Parameters
T- The concrete return type of the closure.F- The closure type.
§Parameters
f- The blocking closure to potentially instrument.