Trait Clock

Source
pub trait Clock: Sized + Send {
    // Required method
    fn get_time(&self) -> Result<Duration>;

    // Provided method
    fn start_timer<'s>(&'s self) -> Result<Timer<'s, Self>> { ... }
}

Required Methods§

Source

fn get_time(&self) -> Result<Duration>

Get the current time value of the clock.

Note that the meaning of the Duration differs depending on implementation. Sometimes the clock represents CPU time, sometimes wall time, etc.

Provided Methods§

Source

fn start_timer<'s>(&'s self) -> Result<Timer<'s, Self>>

Start a timer at the current time

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.

Implementors§