pub trait Sleep: MaybeSend + MaybeSync {
// Required method
fn sleep(&self, duration: Duration) -> BoxFuture<'static, ()>;
}Expand description
Injected timer, the counterpart of Clock for deadlines: Instant and
tokio::time are not available on every target, so an adapter passes in
its runtime’s sleep (tokio::time::sleep on native, worker::Delay on
Workers) and core code bounds an external call with with_timeout.
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".