pub fn timed<Fut, F>(fut: Fut, f: F) -> Timed<Fut, F> ⓘExpand description
Instrument a future to record its timing.
The busy and idle time for the future will be passed as an argument to the provided closure.
See the documentation for Timing for more details. In general, it is more straightforward
to use the TimedFutureExt extension trait to attach instrument a future directly.
§Examples
use future_timed::{timed, Timing};
let output = timed(some_async_fn(), |Timing { idle, busy }| {
assert!(!idle.is_zero());
assert!(!busy.is_zero());
})
.await;
do_something_with_output(output);