Skip to main content

Host

Trait Host 

Source
pub trait Host: Send {
    // Required methods
    fn now(&mut self) -> impl Future<Output = Result<Instant>> + Send;
    fn get_resolution(
        &mut self,
    ) -> impl Future<Output = Result<Duration>> + Send;
}

Required Methods§

Source

fn now(&mut self) -> impl Future<Output = Result<Instant>> + Send

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) -> impl Future<Output = Result<Duration>> + Send

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

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

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

Source§

fn now(&mut self) -> impl Future<Output = Result<Instant>> + Send

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) -> impl Future<Output = Result<Duration>> + Send

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

Implementors§