pub trait SleepProvider {
type Sleep: Future<Output = ()> + Send;
// Required method
fn sleep_for(dur: Duration) -> Self::Sleep;
}Available on crate feature
futures only.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§
Required Methods§
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§
Source§impl SleepProvider for SmolSleep
Available on crate feature async-smol and (crate features async-tokio or async-smol) only.
impl SleepProvider for SmolSleep
Available on crate feature
async-smol and (crate features async-tokio or async-smol) only.type Sleep = SmolSleepFuture
Source§impl SleepProvider for SmolYield
Available on crate feature async-smol and (crate features async-tokio or async-smol) only.
impl SleepProvider for SmolYield
Available on crate feature
async-smol and (crate features async-tokio or async-smol) only.Source§impl SleepProvider for TokioSleep
Available on crate feature async-tokio and (crate features async-tokio or async-smol) only.
impl SleepProvider for TokioSleep
Available on crate feature
async-tokio and (crate features async-tokio or async-smol) only.