[−][src]Struct hierarchical_hash_wheel_timer::wheels::cancellable::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 + CancellableTimerEntry,
[src]
EntryType: TimerEntryWithDelay + CancellableTimerEntry,
pub fn insert(&mut self, e: EntryType) -> Result<(), TimerError<EntryType>>
[src]
Insert a new timeout into the wheel
pub fn insert_ref(
&mut self,
e: Rc<EntryType>
) -> Result<(), TimerError<Rc<EntryType>>>
[src]
&mut self,
e: Rc<EntryType>
) -> Result<(), TimerError<Rc<EntryType>>>
Insert a new timeout into the wheel
impl<EntryType> QuadWheelWithOverflow<EntryType> where
EntryType: CancellableTimerEntry,
[src]
EntryType: CancellableTimerEntry,
pub fn new() -> Self
[src]
Create a new wheel
pub fn insert_ref_with_delay(
&mut self,
e: Rc<EntryType>,
delay: Duration
) -> Result<(), TimerError<Rc<EntryType>>>
[src]
&mut self,
e: Rc<EntryType>,
delay: Duration
) -> Result<(), TimerError<Rc<EntryType>>>
Insert a new timeout into the wheel to be returned after delay
ticks
pub fn cancel(
&mut self,
id: &EntryType::Id
) -> Result<(), TimerError<Infallible>>
[src]
&mut self,
id: &EntryType::Id
) -> Result<(), TimerError<Infallible>>
Cancel the timeout with the given id
This method is very cheap, as it doesn't actually touch the wheels at all. It simply removes the value from the lookup table, so it can't be executed once its triggered. This also automatically prevents rescheduling of periodic timeouts.
pub fn tick(&mut self) -> Vec<Rc<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
Auto Trait Implementations
impl<EntryType> !RefUnwindSafe for QuadWheelWithOverflow<EntryType>
impl<EntryType> !Send for QuadWheelWithOverflow<EntryType>
impl<EntryType> !Sync for QuadWheelWithOverflow<EntryType>
impl<EntryType> Unpin for QuadWheelWithOverflow<EntryType> where
<EntryType as CancellableTimerEntry>::Id: Unpin,
<EntryType as CancellableTimerEntry>::Id: Unpin,
impl<EntryType> !UnwindSafe for QuadWheelWithOverflow<EntryType>
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>,