Skip to main content

PriorityQueue

Struct PriorityQueue 

Source
pub struct PriorityQueue<T> { /* private fields */ }
Expand description

Typed, stable priority queue for host-controlled execution.

The queue never executes values itself. Lower numeric priorities are scheduled first, and insertion order is preserved within each priority.

Implementations§

Source§

impl<T> PriorityQueue<T>

Source

pub fn new() -> Self

Create an empty queue.

Source

pub fn len(&self) -> usize

Number of pending values.

Source

pub fn is_empty(&self) -> bool

Whether the queue has no pending values.

Source

pub fn push(&mut self, priority: Priority, value: T) -> u64

Submit a value and return its stable insertion sequence.

Source

pub fn pop(&mut self) -> Option<PriorityItem<T>>

Claim the highest-priority pending value.

Source

pub fn restore(&mut self, item: PriorityItem<T>)

Return a previously claimed item without changing its original FIFO position. This is intended for admission failures and other cases where execution never acquired ownership of the work.

Source

pub fn ordered(&self) -> Vec<&PriorityItem<T>>

Borrow pending items in the exact order in which they will be claimed.

Source

pub fn clear(&mut self)

Remove all pending values.

Trait Implementations§

Source§

impl<T: Debug> Debug for PriorityQueue<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Default for PriorityQueue<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more