Skip to main content

Clock

Trait Clock 

Source
pub trait Clock {
    // Required methods
    fn sleep(&self, duration: Duration) -> impl Future<Output = ()> + Send;
    fn now_unix(&self) -> i64;
}
Expand description

The time and delay port.

Required Methods§

Source

fn sleep(&self, duration: Duration) -> impl Future<Output = ()> + Send

Wait for duration, then resolve.

Source

fn now_unix(&self) -> i64

Current time as seconds since the Unix epoch.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§