Skip to main content

Clock

Trait Clock 

Source
pub trait Clock:
    Send
    + Sync
    + 'static {
    // Required method
    fn now(&self) -> Instant;
}
Expand description

A source of monotonic time.

§Examples

use net_io::{Clock, MonotonicClock};
let a = MonotonicClock.now();
assert!(MonotonicClock.now() >= a);

Required Methods§

Source

fn now(&self) -> Instant

The current instant.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§