Skip to main content

Timer

Trait Timer 

Source
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§

Source

fn sleep(&self, dur: Duration) -> Pin<Box<dyn Future<Output = ()> + Send>>

Source

fn next_tick(&self) -> Pin<Box<dyn Future<Output = ()> + Send>>

Implementors§