pub trait Timer:
Send
+ Sync
+ 'static {
// Required methods
fn sleep(&self, dur: Duration) -> BoxFuture<'static, ()>;
fn next_tick(&self) -> BoxFuture<'static, ()>;
}Expand description
Async scheduling primitive. Single port for “wait N ms” / “yield event-loop tick”.
Both methods return BoxFuture, so the port is Send on native targets
and needs no Send bridge in the browser.
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl Timer for AdvanceableTimer
Available on crate feature
mock only.impl Timer for NativeTimer
Available on crate feature
native only.