pub struct Timed<F>where
F: Future,{ /* private fields */ }Expand description
Instrumentation to record the timing of a wrapped future.
The Timed wraps any future and records the inner future’s busy and idle time. The
timing is returned together with the inner future’s output once it resolves ready.
§Examples
To wrap a future, use the timed function.
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());Trait Implementations§
Auto Trait Implementations§
impl<F> Freeze for Timed<F>where
F: Freeze,
impl<F> RefUnwindSafe for Timed<F>where
F: RefUnwindSafe,
impl<F> Send for Timed<F>where
F: Send,
impl<F> Sync for Timed<F>where
F: Sync,
impl<F> UnwindSafe for Timed<F>where
F: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<F> IntoFuture for Fwhere
F: Future,
impl<F> IntoFuture for Fwhere
F: Future,
Source§type IntoFuture = F
type IntoFuture = F
Which kind of future are we turning this into?
Source§fn into_future(self) -> <F as IntoFuture>::IntoFuture
fn into_future(self) -> <F as IntoFuture>::IntoFuture
Creates a future from a value. Read more