Skip to main content

Clock

Trait Clock 

Source
pub trait Clock: Send + Sync {
    // Required method
    fn now(&self) -> Timestamp;
}
Expand description

Source of the current time.

Inject a custom implementation in tests to make every expiration, throttle and timeout window deterministic. Production code uses SystemClock.

Required Methods§

Source

fn now(&self) -> Timestamp

Returns the current wall-clock instant as a Timestamp.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<T: Clock + ?Sized> Clock for Arc<T>

Source§

fn now(&self) -> Timestamp

Implementors§