pub trait InstantContext {
    type Instant: Instant + 'static;

    // Required method
    fn now(&self) -> Self::Instant;
Expand description

A context that provides access to a monotonic clock.

Required Associated Types§


type Instant: Instant + 'static

The type of an instant in time.

All time is measured using Instants, including scheduling timers through TimerContext. This type may represent some sort of real-world time (e.g., [std::time::Instant]), or may be faked in testing using a fake clock.

Required Methods§


fn now(&self) -> Self::Instant

Returns the current instant.

now guarantees that two subsequent calls to now will return monotonically non-decreasing values.