Host

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

Required Methods§

Source

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

Read the current value of the clock.

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

For completeness, this function traps if it’s not possible to represent the value of the clock in a mark. Consequently, implementations should ensure that the starting time is low enough to avoid the possibility of overflow in practice.

Source

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

Query the resolution of the clock. Returns the duration of time corresponding to a clock tick.

Implementations on Foreign Types§

Source§

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

Source§

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

Read the current value of the clock.

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

For completeness, this function traps if it’s not possible to represent the value of the clock in a mark. Consequently, implementations should ensure that the starting time is low enough to avoid the possibility of overflow in practice.

Source§

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

Query the resolution of the clock. Returns the duration of time corresponding to a clock tick.

Implementors§