Skip to main content

Clock

Trait Clock 

Source
pub trait Clock {
    // Required method
    fn now(&mut self) -> Duration;
}
Expand description

A monotonic clock reading, injectable so StartupSpans’s deltas are deterministically testable without a real clock. Only differences between successive readings are meaningful — the absolute value has no defined epoch.

Required Methods§

Source

fn now(&mut self) -> Duration

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl Clock for SystemClock

Source§

impl<F: FnMut() -> Duration> Clock for F

Any FnMut() -> Duration closure is a Clock — the lighter-weight option for a one-off test fake (see the module docs’ “injectable clock” note).