pub struct MultiLevelQueue<T> { /* private fields */ }Expand description
Implementations§
Source§impl<T> MultiLevelQueue<T>
impl<T> MultiLevelQueue<T>
Sourcepub fn new(config: AgingConfig) -> Self
pub fn new(config: AgingConfig) -> Self
Create a new queue with the given AgingConfig.
Sourcepub fn push(&self, item: T, priority: Priority)
pub fn push(&self, item: T, priority: Priority)
Enqueue item at the given priority.
This is a non-async, non-blocking call (only acquires the internal
Mutex).
Sourcepub fn pop(&self) -> Option<T>
pub fn pop(&self) -> Option<T>
Dequeue the highest-priority available item.
Runs an aging pass before selecting the item, so a previously low-priority item that has waited long enough may be returned ahead of a recently-added same-level item.
Returns None when all buckets are empty.
Sourcepub fn len_by_priority(&self) -> [usize; 5]
pub fn len_by_priority(&self) -> [usize; 5]
Per-priority item counts. Index i corresponds to Priority level i.
Sourcepub fn stats(&self) -> QueueStats
pub fn stats(&self) -> QueueStats
Snapshot of queue statistics.
Auto Trait Implementations§
impl<T> !Freeze for MultiLevelQueue<T>
impl<T> RefUnwindSafe for MultiLevelQueue<T>
impl<T> Send for MultiLevelQueue<T>
impl<T> Sync for MultiLevelQueue<T>
impl<T> Unpin for MultiLevelQueue<T>
impl<T> UnsafeUnpin for MultiLevelQueue<T>
impl<T> UnwindSafe for MultiLevelQueue<T>
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§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> 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