pub struct PriorityQueue { /* private fields */ }Expand description
Priority queue for events.
Maintains events in priority order with FIFO ordering for events of the same priority. Thread-safe via internal mutex.
§Ordering
Events are ordered by:
- Priority (lower value = higher precedence)
- Insertion order (earlier = higher precedence)
This ensures that high-priority events (like user input) are always processed before low-priority events (like render signals).
Implementations§
Source§impl PriorityQueue
impl PriorityQueue
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create a priority queue with specified capacity.
A capacity of 0 means unlimited (not recommended).
Sourcepub fn push(&self, event: DynEvent) -> bool
pub fn push(&self, event: DynEvent) -> bool
Push an event onto the queue.
Returns false if capacity is exceeded (event is dropped).
Sourcepub fn pop(&self) -> Option<DynEvent>
pub fn pop(&self) -> Option<DynEvent>
Pop the highest priority event.
Returns None if the queue is empty.
Sourcepub fn peek_priority(&self) -> Option<u32>
pub fn peek_priority(&self) -> Option<u32>
Peek at the priority of the next event without removing it.
Returns None if the queue is empty.
Trait Implementations§
Source§impl Debug for PriorityQueue
impl Debug for PriorityQueue
Auto Trait Implementations§
impl !Freeze for PriorityQueue
impl !RefUnwindSafe for PriorityQueue
impl Send for PriorityQueue
impl Sync for PriorityQueue
impl Unpin for PriorityQueue
impl UnsafeUnpin for PriorityQueue
impl !UnwindSafe for PriorityQueue
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