pub struct TimerMap<T>(/* private fields */);
Expand description
A BTreeMap
with [Instant
] as key. Allows to process expired items.
Implementations§
Source§impl<T> TimerMap<T>
impl<T> TimerMap<T>
Sourcepub fn insert(&mut self, instant: Instant, item: T)
pub fn insert(&mut self, instant: Instant, item: T)
Insert a new entry at the specified instant.
Sourcepub fn drain_until(
&mut self,
from: &Instant,
) -> impl Iterator<Item = (Instant, T)>
pub fn drain_until( &mut self, from: &Instant, ) -> impl Iterator<Item = (Instant, T)>
Remove and return all entries before and equal to from
.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for TimerMap<T>
impl<T> RefUnwindSafe for TimerMap<T>where
T: RefUnwindSafe,
impl<T> Send for TimerMap<T>where
T: Send,
impl<T> Sync for TimerMap<T>where
T: Sync,
impl<T> Unpin for TimerMap<T>
impl<T> UnwindSafe for TimerMap<T>where
T: RefUnwindSafe,
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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