Trait InstantProvider

Source
pub trait InstantProvider<D = Duration>
where Self: Sub<Self, Output = D> + Clone,
{ // Required method fn now() -> Self; // Provided method fn elapsed(&self) -> D { ... } }
Expand description

An abstraction for retrieving the current time.

The underlying counter shell be monotonic in order for the crate to operate correctly.

Required Methods§

Source

fn now() -> Self

Returns an instant corresponding to “now”.

Provided Methods§

Source

fn elapsed(&self) -> D

Returns the amount of time elapsed since this instant.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl InstantProvider for Instant

Source§

fn now() -> Self

Implementors§