pub trait Clock:
Named
+ Send
+ Sync {
// Required method
fn now(&self) -> Instant;
// Provided methods
fn tick(&self, observed: Instant) -> Instant { ... }
fn unix_secs(&self) -> u64 { ... }
fn unix_ms(&self) -> u64 { ... }
}Expand description
Universal clock surface. Implementers supply now();
HLC-aware implementers additionally implement tick(observed).
Required Methods§
Provided Methods§
Sourcefn tick(&self, observed: Instant) -> Instant
fn tick(&self, observed: Instant) -> Instant
HLC merge: given an observed Instant from elsewhere, return
the next local Instant that is strictly after both self.now()
AND observed. Default implementation is wall-clock-based;
HLC-aware clocks override.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".