Trait Clock
Source pub trait Clock: Send + Sync {
// Required method
fn now(&self) -> Millis;
}
Expand description
A source of time, injected into the Registry (FR-05).
The server passes a system clock; tests pass a FakeClock. Any
Fn() -> Millis + Send + Sync closure is also a clock.
use hardless_core::{Clock, Millis};
let fixed = || Millis(42);
assert_eq!(fixed.now(), Millis(42));
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".