Trait pal_async::timer::PollTimer

source ·
pub trait PollTimer:
    Unpin
    + Send
    + Sync {
    // Required methods
    fn poll_timer(
        &mut self,
        cx: &mut Context<'_>,
        deadline: Option<Instant>,
    ) -> Poll<Instant>;
    fn set_deadline(&mut self, deadline: Instant);
}
Expand description

A trait for polling timers.

Required Methods§

source

fn poll_timer( &mut self, cx: &mut Context<'_>, deadline: Option<Instant>, ) -> Poll<Instant>

Polls the timer, optionally updating the deadline first.

Returns ready with the current time when the set deadline <= Instant::now().

source

fn set_deadline(&mut self, deadline: Instant)

Updates the timer’s deadline.

Implementors§