pub struct MessagePriorityQueue { /* private fields */ }Expand description
Priority queue for messages
Messages are ordered by priority (0-9, higher = more important), with FIFO ordering within the same priority level.
Implementations§
Source§impl MessagePriorityQueue
impl MessagePriorityQueue
Sourcepub fn with_capacity(max_size: usize) -> Self
pub fn with_capacity(max_size: usize) -> Self
Create a priority queue with a maximum size
Sourcepub fn push(&mut self, message: Message) -> bool
pub fn push(&mut self, message: Message) -> bool
Push a message onto the queue
Returns true if the message was added, false if the queue is full
Sourcepub fn peek(&self) -> Option<&Message>
pub fn peek(&self) -> Option<&Message>
Peek at the highest priority message without removing it
Sourcepub fn filter_by_priority(&self, priority: u8) -> Vec<&Message>
pub fn filter_by_priority(&self, priority: u8) -> Vec<&Message>
Get messages with a specific priority
Sourcepub fn count_by_priority(&self) -> [usize; 10]
pub fn count_by_priority(&self) -> [usize; 10]
Count messages by priority level
Trait Implementations§
Source§impl Clone for MessagePriorityQueue
impl Clone for MessagePriorityQueue
Source§fn clone(&self) -> MessagePriorityQueue
fn clone(&self) -> MessagePriorityQueue
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MessagePriorityQueue
impl Debug for MessagePriorityQueue
Source§impl Default for MessagePriorityQueue
impl Default for MessagePriorityQueue
Source§impl Extend<Message> for MessagePriorityQueue
impl Extend<Message> for MessagePriorityQueue
Source§fn extend<T: IntoIterator<Item = Message>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = Message>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl FromIterator<Message> for MessagePriorityQueue
impl FromIterator<Message> for MessagePriorityQueue
Auto Trait Implementations§
impl Freeze for MessagePriorityQueue
impl RefUnwindSafe for MessagePriorityQueue
impl Send for MessagePriorityQueue
impl Sync for MessagePriorityQueue
impl Unpin for MessagePriorityQueue
impl UnwindSafe for MessagePriorityQueue
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