Sleeper

Trait Sleeper 

Source
pub trait Sleeper: 'static {
    type Sleep: Future;

    // Required method
    fn sleep(&self, dur: Duration) -> Self::Sleep;
}
Expand description

A sleeper is used to generate a future that completes after a specified duration.

Required Associated Types§

Source

type Sleep: Future

The future returned by the sleep method.

Required Methods§

Source

fn sleep(&self, dur: Duration) -> Self::Sleep

Create a future that completes after a set period.

Implementors§

Source§

impl Sleeper for TokioSleeper

Available on non-WebAssembly and crate feature tokio-sleep only.
Source§

impl<F: Fn(Duration) -> Fut + 'static, Fut: Future> Sleeper for F

All Fn(Duration) -> impl Future implements Sleeper.

Source§

type Sleep = Fut