Skip to main content

MonotonicClock

Trait MonotonicClock 

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

A monotonic time source.

Production stores use SystemMonotonicClock. The trait is public so deterministic test dependencies can advance time without sleeping.

Required Methods§

Source

fn now(&self) -> Instant

Returns the current monotonic instant.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§