pub struct Wheel<T, const N0: usize, const N: usize, const L: usize> { /* private fields */ }Implementations§
Source§impl<T, const N0: usize, const N: usize, const L: usize> Wheel<T, N0, N, L>
impl<T, const N0: usize, const N: usize, const L: usize> Wheel<T, N0, N, L>
Sourcepub fn roll_count(&self) -> usize
pub fn roll_count(&self) -> usize
获得滚动次数
Sourcepub fn is_cur_over(&self) -> bool
pub fn is_cur_over(&self) -> bool
判断当前槽位是否还有定时任务
Sourcepub fn push(&mut self, it: TimeoutItem<T>) -> Option<TimeoutItem<T>>
pub fn push(&mut self, it: TimeoutItem<T>) -> Option<TimeoutItem<T>>
放入一个定时任务,定时时间如果超过定时轮的最大定时时间,则返回修正时间后的该定时任务
Sourcepub fn pop(&mut self) -> Option<TimeoutItem<T>>
pub fn pop(&mut self) -> Option<TimeoutItem<T>>
弹出最小精度的一个定时任务
- @tip 弹出 None 时,外部可以检查时间决定是否roll
- @return
Option<Item<T>>弹出的定时元素
Trait Implementations§
Auto Trait Implementations§
impl<T, const N0: usize, const N: usize, const L: usize> Freeze for Wheel<T, N0, N, L>
impl<T, const N0: usize, const N: usize, const L: usize> RefUnwindSafe for Wheel<T, N0, N, L>where
T: RefUnwindSafe,
impl<T, const N0: usize, const N: usize, const L: usize> Send for Wheel<T, N0, N, L>where
T: Send,
impl<T, const N0: usize, const N: usize, const L: usize> Sync for Wheel<T, N0, N, L>where
T: Sync,
impl<T, const N0: usize, const N: usize, const L: usize> Unpin for Wheel<T, N0, N, L>where
T: Unpin,
impl<T, const N0: usize, const N: usize, const L: usize> UnwindSafe for Wheel<T, N0, N, L>where
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