pub trait Timer:
Send
+ Sync
+ 'static {
// Required methods
fn sleep(&self, dur: Duration) -> Pin<Box<dyn Future<Output = ()> + Send>>;
fn next_tick(&self) -> Pin<Box<dyn Future<Output = ()> + Send>>;
}Expand description
Async scheduling primitive. Single port for “wait N ms” / “yield event-loop tick”.
Required Methods§
fn sleep(&self, dur: Duration) -> Pin<Box<dyn Future<Output = ()> + Send>>
fn next_tick(&self) -> Pin<Box<dyn Future<Output = ()> + Send>>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".