Struct ora_timer::wheel::TimingWheel
source · pub struct TimingWheel<T, R = Milliseconds>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 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, 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> RefUnwindSafe for TimingWheel<T, R>where R: RefUnwindSafe, T: RefUnwindSafe,
impl<T, R> Send for TimingWheel<T, R>where R: Send, T: Send,
impl<T, R> Sync for TimingWheel<T, R>where R: Sync, T: Sync,
impl<T, R> Unpin for TimingWheel<T, R>where R: Unpin, T: Unpin,
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