Skip to main content

CpuTimedExt

Trait CpuTimedExt 

Source
pub trait CpuTimedExt: Future + Sized {
    // Provided method
    fn cpu_timed(self, counter: Counter) -> CpuTimedFuture<Self>  { ... }
}
Expand description

Extension trait that wraps a future in CpuTimedFuture via a chained call:

async move { /* work */ }.cpu_timed(counter)

Mirrors the style of [tracing::Instrument::in_current_span].

Provided Methods§

Source

fn cpu_timed(self, counter: Counter) -> CpuTimedFuture<Self>

Wraps this future in a CpuTimedFuture that increments counter by the thread CPU time consumed on each poll.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§