pub trait Clock:
Send
+ Sync
+ Debug {
// Required methods
fn now(&self) -> Instant;
fn sleep_until(&self, deadline: Instant) -> Sleep;
}Expand description
A monotonic clock. Returns tokio::time::Instant so the value slots
straight into the existing lease/deadline fields without a type change.
Debug is required because MemoryStore
derives it and holds a clock.
Required Methods§
Sourcefn sleep_until(&self, deadline: Instant) -> Sleep
fn sleep_until(&self, deadline: Instant) -> Sleep
Resolve once this clock reaches deadline.
Returns immediately if deadline is already past. On a frozen
clock this parks until the test advances past deadline. It must
never fall back to real time, or the freeze leaks.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".