timed

Function timed 

Source
pub fn timed<F>(fut: F) -> Timed<F> 
where F: Future,
Expand description

Instrument a future to record its timing

The busy and idle time for the future will be recorded separately in the result together with the output of the wrapped future. See the documentation for Timing for more details.

§Examples

    let output = future_timing::timed(some_async_fn()).await;
    let (timing, future_output) = output.into_parts();

    do_something_with_output(future_output);

    assert!(!timing.idle().is_zero());
    assert!(!timing.busy().is_zero());