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§
sourcefn poll_timer(
&mut self,
cx: &mut Context<'_>,
deadline: Option<Instant>,
) -> Poll<Instant>
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()
.
sourcefn set_deadline(&mut self, deadline: Instant)
fn set_deadline(&mut self, deadline: Instant)
Updates the timer’s deadline.