Trait SleepProvider

Source
pub trait SleepProvider {
    type Sleep: Future<Output = ()>;

    // Required method
    fn sleep_for(dur: Duration) -> Self::Sleep;
}
Expand description

A trait that abstracts over how to sleep for a given Duration in async contexts.

This allows the generator to be generic over runtimes like Tokio or Smol.

Required Associated Types§

Source

type Sleep: Future<Output = ()>

Required Methods§

Source

fn sleep_for(dur: Duration) -> Self::Sleep

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§