[][src]Struct async_priority_queue::PriorityQueue

pub struct PriorityQueue<T> { /* fields omitted */ }

An async-aware priority queue.

Implementations

impl<T: Ord> PriorityQueue<T>[src]

pub fn new() -> Self[src]

pub fn push(&self, item: T)[src]

Pushes an item into the queue. It will be removed in an order consistent with the ordering of itself relative to other items in the queue at the time of removal.

pub fn try_pop(&self) -> Option<T>[src]

Attempts to remove the item with the highest priority from the queue, returning None if there are no available items.

pub fn pop(&self) -> PopFut<'_, T>

Notable traits for PopFut<'a, T>

impl<'a, T: Ord> Future for PopFut<'a, T> type Output = T;
[src]

Removes the item with the highest priority from the queue, waiting for an item should there not be one immediately available.

Items are removed from the queue on a 'first come, first served' basis.

pub fn incoming(&self) -> IncomingStream<'_, T>[src]

Returns a stream of highest-priority items from this queue.

Items are removed from the queue on a 'first come, first served' basis.

pub fn pending(&self) -> impl Iterator<Item = T> + '_[src]

Returns an iterator of pending items from the queue (i.e: those that have already been inserted). Items will only be removed from the queue as the iterator is advanced.

pub fn drain(&self) -> impl ExactSizeIterator<Item = T> + FusedIterator[src]

Returns an iterator of items currently occupying the queue, immediately draining the queue.

pub fn len(&self) -> usize[src]

Return the number of items currently occupying the priority queue.

Because the queue is asynchronous, this information should be considered out of date immediately and, as such, should only be used for the purpose of logging, heuristics, etc.

pub fn is_empty(&self) -> bool[src]

Return true if the priority queue is currently empty.

Because the queue is asynchronous, this information should be considered out of date immediately and, as such, should only be used for the purpose of logging, heuristics, etc.

Trait Implementations

impl<T: Ord> Default for PriorityQueue<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for PriorityQueue<T>[src]

impl<T> Send for PriorityQueue<T> where
    T: Send
[src]

impl<T> Sync for PriorityQueue<T> where
    T: Send
[src]

impl<T> Unpin for PriorityQueue<T> where
    T: Unpin
[src]

impl<T> UnwindSafe for PriorityQueue<T>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.