Skip to main content

Clock

Trait Clock 

Source
pub trait Clock {
    // Required method
    fn now(&self) -> Instant;
}
Available on crate feature time only.
Expand description

A source of time for lifecycles.

A clock returns the current Instant. The meaning of “now” is determined by the implementation:

  • ManualClock is deterministic and controlled by tests.
  • SystemClock is monotonic time since the clock was created.

Required Methods§

Source

fn now(&self) -> Instant

Returns the current instant.

Implementors§