Skip to main content

SleepCapability

Trait SleepCapability 

Source
pub trait SleepCapability: Clone + Debug {
    // Required methods
    fn new() -> Self;
    fn sleep(&self, duration: Duration) -> impl Future<Output = ()> + MaybeSend;
}

Required Methods§

Source

fn new() -> Self

Construct a new sleeper.

Stateless impls return a unit struct; stateful impls (mock clocks, virtual time sources, etc.) should return a sensible default. Callers that don’t have an instance handy can use the static-style C::new().sleep(duration) pattern, mirroring HttpClientCapability’s new_client() + request(&self) shape.

Source

fn sleep(&self, duration: Duration) -> impl Future<Output = ()> + MaybeSend

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§