pub struct TimingWheel<T, R = MillisecondResolution>where
R: Resolution,{ /* private fields */ }
Expand description
A hierarchical timing wheel with a given entry type and resolution.
Implementations§
Source§impl<T, R> TimingWheel<T, R>where
R: Resolution,
impl<T, R> TimingWheel<T, R>where
R: Resolution,
Sourcepub fn insert(&mut self, entry: T, delay: Duration) -> Option<T>
pub fn insert(&mut self, entry: T, delay: Duration) -> Option<T>
Returns the entry if it has already expired.
Sourcepub fn tick(&mut self) -> Vec<T>
pub fn tick(&mut self) -> Vec<T>
Advance the timing wheel and collect all entries that have been expired.
Sourcepub fn tick_with(&mut self, res: &mut Vec<T>)
pub fn tick_with(&mut self, res: &mut Vec<T>)
Advance the timing wheel and collect all entries that have been expired.
Sourcepub fn skip(&mut self, amount: u32)
pub fn skip(&mut self, amount: u32)
Skip amount
steps, note that this will succeed
and no checks will take place.
Use TimingWheel::can_skip
to determine if this function
can be used without silently dropping any entries that
have not been expired.
Trait Implementations§
Source§impl<T: Debug, R> Debug for TimingWheel<T, R>where
R: Resolution + Debug,
impl<T: Debug, R> Debug for TimingWheel<T, R>where
R: Resolution + Debug,
Source§impl<T, R> Default for TimingWheel<T, R>where
R: Resolution,
impl<T, R> Default for TimingWheel<T, R>where
R: Resolution,
Auto Trait Implementations§
impl<T, R> Freeze for TimingWheel<T, R>
impl<T, R> RefUnwindSafe for TimingWheel<T, R>where
R: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, R> Send for TimingWheel<T, R>
impl<T, R> Sync for TimingWheel<T, R>
impl<T, R> Unpin for TimingWheel<T, R>
impl<T, R> UnwindSafe for TimingWheel<T, R>where
R: UnwindSafe,
T: 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