Skip to main content

Clock

Trait Clock 

Source
pub trait Clock:
    Send
    + Sync
    + Debug {
    // Required methods
    fn now(&self) -> Duration;
    fn at(&self, at: Duration, job: Job);
}
Expand description

A source of time that runs jobs at a given moment.

Times are offsets from the clock’s own start. Jobs due at the same moment run in the order they were given.

Required Methods§

Source

fn now(&self) -> Duration

Time since the clock started.

Source

fn at(&self, at: Duration, job: Job)

Run job once now reaches at (at once, or soon, when it already has).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl Clock for ManualClock

Source§

impl Clock for SystemClock

Source§

impl Clock for TokioClock

Available on crate feature tokio only.