pub trait Delay {
// Required method
fn sleep(&self, d: Duration) -> impl Future<Output = ()> + Send;
}Expand description
A non-allocating sleep.
RuntimeOps::sleep is dyn and must
box; this one is generic and returns the adapter’s own timer type with
nothing on the heap. Only sleeping lives here — RuntimeOps::now_nanos is a
plain call and stays the clock.
The returned future borrows nothing, so a task holding a D: Delay still
produces 'static futures from it.
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".