Struct timer_list::TimerList
source · pub struct TimerList<E: TimerEvent> { /* private fields */ }
Expand description
A list of timed events.
It internally uses a min-heap to store the events by deadline, make it possible to trigger these events sequentially.
Implementations§
source§impl<E: TimerEvent> TimerList<E>
impl<E: TimerEvent> TimerList<E>
sourcepub fn set(&mut self, deadline: TimeValue, event: E)
pub fn set(&mut self, deadline: TimeValue, event: E)
Set a timed event that will be triggered at deadline
.
sourcepub fn next_deadline(&self) -> Option<TimeValue>
pub fn next_deadline(&self) -> Option<TimeValue>
Get the deadline of the most recent event.
sourcepub fn expire_one(&mut self, now: TimeValue) -> Option<(TimeValue, E)>
pub fn expire_one(&mut self, now: TimeValue) -> Option<(TimeValue, E)>
Try to expire the earliest event that passed the deadline at the given time.
Returns None
if no event is expired.
Trait Implementations§
Auto Trait Implementations§
impl<E> RefUnwindSafe for TimerList<E>where
E: RefUnwindSafe,
impl<E> Send for TimerList<E>where
E: Send,
impl<E> Sync for TimerList<E>where
E: Sync,
impl<E> Unpin for TimerList<E>where
E: Unpin,
impl<E> UnwindSafe for TimerList<E>where
E: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more