Skip to main content

Host

Trait Host 

Source
pub trait Host {
    // Required methods
    fn now(&mut self) -> Result<Instant>;
    fn get_resolution(&mut self) -> Result<Duration>;
}
Available on crate feature p3 only.

Required Methods§

Source

fn now(&mut self) -> Result<Instant>

Read the current value of the clock.

This clock is not monotonic, therefore calling this function repeatedly will not necessarily produce a sequence of non-decreasing values.

The nanoseconds field of the output is always less than 1000000000.

Source

fn get_resolution(&mut self) -> Result<Duration>

Query the resolution of the clock. Returns the smallest duration of time that the implementation permits distinguishing.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<_T: Host + ?Sized> Host for &mut _T

Source§

fn now(&mut self) -> Result<Instant>

Read the current value of the clock.

This clock is not monotonic, therefore calling this function repeatedly will not necessarily produce a sequence of non-decreasing values.

The nanoseconds field of the output is always less than 1000000000.

Source§

fn get_resolution(&mut self) -> Result<Duration>

Query the resolution of the clock. Returns the smallest duration of time that the implementation permits distinguishing.

Implementors§