Skip to main content

Clock

Trait Clock 

Source
pub trait Clock:
    Send
    + Sync
    + 'static {
    // Required method
    fn now(&self) -> Instant;
}
Expand description

Wall-clock abstraction so the bucket can be exercised in tests without sleeping. Only now() is on the trait surface; every internal math op is pure and does not need further mocking.

Required Methods§

Source

fn now(&self) -> Instant

A monotonically-nondecreasing instant. Callers must rely on the return values’ ordering, not their absolute origin.

Implementors§