injectable_time

Trait TimeSource

Source
pub trait TimeSource: Debug {
    // Required method
    fn now(&self) -> i64;
}
Expand description

TimeSource provides the current time in nanoseconds since the Unix epoch. A &'a dyn TimeSource can be injected into a data structure. TimeSource is implemented by UtcInstant for wall-clock system time, and FakeTime for a clock that is explicitly set by testing code.

Required Methods§

Source

fn now(&self) -> i64

Implementors§