pub trait Clock:
Send
+ Sync
+ Debug {
// Required method
fn now(&self) -> Duration;
}Expand description
Monotonic time source for the breaker, injectable so tests can drive the cooldown deterministically rather than sleeping.
The single method returns an opaque “now” as a Duration since an
arbitrary fixed epoch — the breaker only ever compares two such
values, never reads wall-clock time, so a Duration from a private
origin is sufficient and keeps the manual clock a trivial counter.
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".