pub trait Sleep {
type Poll: Future;
// Required method
fn next_poll(&mut self) -> Self::Poll;
}Expand description
Governs the behaviour of of polling in async functions.
There is a generic implementation for any function retuning a future. This allows e.g. to pass
|| tokio::time::sleep(Duration::from_millis(50)) to functions expecting sleep. That is if
you use tokio as your async runtime, of course.
Required Associated Types§
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".