PrioQueue

Trait PrioQueue 

Source
pub trait PrioQueue: Queue {
    // Provided methods
    fn push_pop_front(&mut self, item: Self::Item) -> Self::Item
       where Self: AddRemove { ... }
    fn replace_front(&mut self, item: Self::Item) -> Option<Self::Item>
       where Self: AddRemove { ... }
}
Expand description

A priority queue.

Provided Methods§

Source

fn push_pop_front(&mut self, item: Self::Item) -> Self::Item
where Self: AddRemove,

Pushes the given item onto the queue, then removes the item at the front of the queue and returns it.

This method may be deprecated in favor of front_mut in the future.

Source

fn replace_front(&mut self, item: Self::Item) -> Option<Self::Item>
where Self: AddRemove,

Removes the item at the front of the queue, then pushes the given item onto the queue.

Returns the item that was removed, or None if the queue was empty.

This method may be deprecated in favor of front_mut in the future.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T: Ord> PrioQueue for BinaryHeap<T>

Source§

fn push_pop_front(&mut self, item: T) -> T

Source§

fn replace_front(&mut self, item: T) -> Option<T>

Implementors§