rustmax::hyper::rt

Trait Timer

Source
pub trait Timer {
    // Required methods
    fn sleep(&self, duration: Duration) -> Pin<Box<dyn Sleep<Output = ()>>>;
    fn sleep_until(&self, deadline: Instant) -> Pin<Box<dyn Sleep<Output = ()>>>;

    // Provided method
    fn reset(
        &self,
        sleep: &mut Pin<Box<dyn Sleep<Output = ()>>>,
        new_deadline: Instant,
    ) { ... }
}
Expand description

A timer which provides timer-like functions.

Required Methods§

Source

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

Return a future that resolves in duration time.

Source

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

Return a future that resolves at deadline.

Provided Methods§

Source

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

Reset a future to resolve at new_deadline instead.

Implementations on Foreign Types§

Source§

impl Timer for TokioTimer

Source§

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

Source§

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

Source§

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

Implementors§