Skip to main content

TimeSource

Trait TimeSource 

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

Object to get current SystemTime

This exists to allow system time to be mocked in tests, or wherever else desired.

Required Methods§

Source

fn now(&self) -> SystemTime

Get SystemTime::now() or the mocked equivalent

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§