Skip to main content

Clock

Trait Clock 

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

A monotonic time source.

Production code uses SystemClock, which delegates to Instant::now. Tests and loom models inject a ManualClock so the refill computation runs against deterministic timestamps.

Required Methods§

Source

fn now(&self) -> Instant

Returns a monotonic instant. Successive calls must never return an earlier instant than a prior call.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<C: Clock + ?Sized> Clock for &C

Source§

fn now(&self) -> Instant

Source§

impl<C: Clock + ?Sized> Clock for Arc<C>

Source§

fn now(&self) -> Instant

Implementors§