pub struct PriorityQueue<T> { /* private fields */ }Expand description
Multi-level priority queue
Implementations§
Source§impl<T> PriorityQueue<T>
impl<T> PriorityQueue<T>
Sourcepub fn new(config: PriorityConfig) -> Self
pub fn new(config: PriorityConfig) -> Self
Create a new priority queue
Sourcepub fn with_default_config() -> Self
pub fn with_default_config() -> Self
Create with default configuration
Sourcepub fn enqueue(&mut self, mail_id: MailId, item: T, priority: Priority)
pub fn enqueue(&mut self, mail_id: MailId, item: T, priority: Priority)
Enqueue an item with a specific priority
Sourcepub fn dequeue(&mut self) -> Option<(MailId, T, Priority)>
pub fn dequeue(&mut self) -> Option<(MailId, T, Priority)>
Dequeue the next item based on priority (highest priority first)
Sourcepub fn peek(&self) -> Option<(&MailId, &T, Priority)>
pub fn peek(&self) -> Option<(&MailId, &T, Priority)>
Peek at the next item without removing it
Sourcepub fn len_for_priority(&self, priority: Priority) -> usize
pub fn len_for_priority(&self, priority: Priority) -> usize
Get the number of items in a specific priority queue
Sourcepub fn remove(&mut self, mail_id: &MailId) -> Option<(T, Priority)>
pub fn remove(&mut self, mail_id: &MailId) -> Option<(T, Priority)>
Remove a specific item by mail ID
Sourcepub fn update_config(&self, config: PriorityConfig)
pub fn update_config(&self, config: PriorityConfig)
Update priority configuration
Sourcepub fn get_config(&self) -> PriorityConfig
pub fn get_config(&self) -> PriorityConfig
Get current configuration
Sourcepub fn stats_for_priority(&self, priority: Priority) -> PriorityStats
pub fn stats_for_priority(&self, priority: Priority) -> PriorityStats
Get statistics for a specific priority
Sourcepub fn mark_delivered(&self, priority: Priority)
pub fn mark_delivered(&self, priority: Priority)
Mark item as delivered (for statistics)
Sourcepub fn update_ready_delayed_stats(
&self,
priority: Priority,
ready: usize,
delayed: usize,
)
pub fn update_ready_delayed_stats( &self, priority: Priority, ready: usize, delayed: usize, )
Update ready/delayed counts for a priority
Sourcepub fn items_for_priority(&self, priority: Priority) -> Vec<&(MailId, T)>
pub fn items_for_priority(&self, priority: Priority) -> Vec<&(MailId, T)>
Get all items for a specific priority
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for PriorityQueue<T>
impl<T> RefUnwindSafe for PriorityQueue<T>where
T: RefUnwindSafe,
impl<T> Send for PriorityQueue<T>where
T: Send,
impl<T> Sync for PriorityQueue<T>where
T: Sync,
impl<T> Unpin for PriorityQueue<T>where
T: Unpin,
impl<T> UnsafeUnpin for PriorityQueue<T>
impl<T> UnwindSafe for PriorityQueue<T>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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request