pub struct EventQueue {
arena: Vec<EventNode>,
arena_used: u32,
free_head: u32,
wheel_head: Vec<u32>,
wheel_tail: Vec<u32>,
slot_bitmap: [u64; 512],
current_slot: usize,
current_time_ms: u32,
wheel_base_ms: u32,
overflow: Vec<OverflowEntry>,
next_seq: u64,
count: usize,
}Expand description
Priority event queue using a timing wheel with arena-allocated linked lists.
Fields§
§arena: Vec<EventNode>§arena_used: u32§free_head: u32§wheel_head: Vec<u32>§wheel_tail: Vec<u32>§slot_bitmap: [u64; 512]§current_slot: usize§current_time_ms: u32§wheel_base_ms: u32§overflow: Vec<OverflowEntry>§next_seq: u64§count: usizeImplementations§
Source§impl EventQueue
impl EventQueue
pub(super) fn insert_into_wheel(&mut self, time_ms: u32, seq: u64, event: Event)
pub(super) fn rotate_wheel_base(&mut self)
pub(super) fn pop_from_slot(&mut self, slot: usize, head_idx: u32) -> Event
pub(super) fn set_slot_bit(&mut self, slot: usize)
pub(super) fn clear_slot_bit(&mut self, slot: usize)
pub(super) fn find_next_slot(&self) -> Option<usize>
pub(super) fn alloc_node(&mut self, time_ms: u32, seq: u64, event: Event) -> u32
pub(super) fn free_node(&mut self, idx: u32)
Source§impl EventQueue
impl EventQueue
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Construct an empty queue, pre-sizing the arena to at least capacity nodes.
Sourcepub fn push(&mut self, event: Event)
pub fn push(&mut self, event: Event)
Push an event onto the queue.
§Panics
Panics if the event precedes the last event popped from this queue.
Sourcepub fn pop(&mut self) -> Option<Event>
pub fn pop(&mut self) -> Option<Event>
Pop the highest-priority event (smallest timestamp, priority, then sequence).
Trait Implementations§
Source§impl Debug for EventQueue
impl Debug for EventQueue
Auto Trait Implementations§
impl Freeze for EventQueue
impl RefUnwindSafe for EventQueue
impl Send for EventQueue
impl Sync for EventQueue
impl Unpin for EventQueue
impl UnsafeUnpin for EventQueue
impl UnwindSafe for EventQueue
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more