Trait Timer

pub trait Timer

A timer which provides timer-like functions.

Required Methods

fn sleep(&self, duration: Duration) -> Pin<Box<dyn Sleep>>

Return a future that resolves in duration time.

fn sleep_until(&self, deadline: Instant) -> Pin<Box<dyn Sleep>>

Return a future that resolves at deadline.

Provided Methods

fn now(&self) -> Instant

Return an Instant representing the current time.

The default implementation returns [Instant::now()].

fn reset(&self, sleep: &mut Pin<Box<dyn Sleep>>, new_deadline: Instant)

Reset a future to resolve at new_deadline instead.