Skip to main content

Clock

Trait Clock 

Source
pub trait Clock:
    Send
    + Sync
    + 'static {
    // Required methods
    fn now(&self) -> Duration;
    fn schedule(&self, delay: Duration, job: Box<dyn FnOnce() + Send>);
}
Expand description

A scheduler usable from any executor. A manual clock makes fault tests independent of sleep.

Required Methods§

Source

fn now(&self) -> Duration

Source

fn schedule(&self, delay: Duration, job: Box<dyn FnOnce() + Send>)

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§