pub trait Clock {
// Required method
fn now(&self) -> SystemTime;
}
Expand description
A trait that represents the capability to read the system time.
Using implementations of this trait instead of accessing the system clock directly allows mocking with a controlled clock for testing purposes.
Required Methods§
Sourcefn now(&self) -> SystemTime
fn now(&self) -> SystemTime
Returns the current system time, according to this clock.
Implementations on Foreign Types§
Implementors§
impl Clock for SystemClock
impl Clock for FixedClock
Available on crate feature
test-dependencies
only.