[−][src]Struct hierarchical_hash_wheel_timer::wheels::quad_wheel::QuadWheelWithOverflow
An implementation of four-level byte-sized wheel
Any value scheduled so far off that it doesn't fit into the wheel
is stored in an overflow Vec
and added to the wheel, once time as advanced enough
that it actually fits.
In this design the maximum schedule duration for the wheel itself is u32::MAX
units (typically ms),
everything else goes into the overflow Vec
.
Methods
impl<EntryType> QuadWheelWithOverflow<EntryType> where
EntryType: TimerEntryWithDelay,
[src]
EntryType: TimerEntryWithDelay,
pub fn insert(&mut self, e: EntryType) -> Result<(), TimerError<EntryType>>
[src]
Insert a new timeout into the wheel
impl<EntryType> QuadWheelWithOverflow<EntryType> where
EntryType: Debug,
[src]
EntryType: Debug,
pub fn new(pruner: fn(_: &EntryType) -> PruneDecision) -> Self
[src]
Create a new wheel
pub fn remaining_time_in_cycle(&self) -> u64
[src]
Described how many ticks are left before the timer has wrapped around completely
pub fn current_time_in_cycle(&self) -> u32
[src]
Produces a 32-bit timestamp including the current index of every wheel
pub fn insert_with_delay(
&mut self,
e: EntryType,
delay: Duration
) -> Result<(), TimerError<EntryType>>
[src]
&mut self,
e: EntryType,
delay: Duration
) -> Result<(), TimerError<EntryType>>
Insert a new timeout into the wheel to be returned after delay
ticks
pub fn tick(&mut self) -> Vec<EntryType>
[src]
Move the wheel forward by a single unit (ms)
Returns a list of all timers that expire during this tick.
pub fn skip(&mut self, amount: u32)
[src]
Skip a certain amount
of units (ms)
No timers will be executed for the skipped time. Only use this after determining that it's actually valid with can_skip!
pub fn can_skip(&self) -> Skip
[src]
Determine if and how many ticks can be skipped
Trait Implementations
impl<EntryType> Default for QuadWheelWithOverflow<EntryType> where
EntryType: Debug,
[src]
EntryType: Debug,
Auto Trait Implementations
impl<EntryType> RefUnwindSafe for QuadWheelWithOverflow<EntryType> where
EntryType: RefUnwindSafe,
EntryType: RefUnwindSafe,
impl<EntryType> Send for QuadWheelWithOverflow<EntryType> where
EntryType: Send,
EntryType: Send,
impl<EntryType> Sync for QuadWheelWithOverflow<EntryType> where
EntryType: Sync,
EntryType: Sync,
impl<EntryType> Unpin for QuadWheelWithOverflow<EntryType> where
EntryType: Unpin,
EntryType: Unpin,
impl<EntryType> UnwindSafe for QuadWheelWithOverflow<EntryType> where
EntryType: UnwindSafe,
EntryType: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,