Skip to main content

Clock

Trait Clock 

Source
pub trait Clock {
    type Instant: Instant;

    // Required methods
    fn wait_until(&self, time: Self::Instant) -> impl Future<Output = ()>;
    fn now(&self) -> Self::Instant;
}
Expand description

Provides access to system-time-related operations.

Required Associated Types§

Source

type Instant: Instant

The type representing monotonic system time.

Required Methods§

Source

fn wait_until(&self, time: Self::Instant) -> impl Future<Output = ()>

Completes once the monotonic system time is at or after the given time.

Source

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

Gets the monotonic system time.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§