Struct std::collections::priority_queue::PriorityQueue[src]
pub struct PriorityQueue<T> {
// some fields omitted
}A priority queue implemented with a binary heap
Methods
impl<T: Ord> PriorityQueue<T>
fn iter<T: Ord>(&'a self) -> Items<'a, T>
An iterator visiting all values in underlying vector, in arbitrary order.
fn top<T: Ord>(&'a self) -> Option<&'a T>
Returns the greatest item in a queue or None if it is empty
fn maybe_top<T: Ord>(&'a self) -> Option<&'a T>
fn capacity<T: Ord>(&self) -> uint
Returns the number of elements the queue can hold without reallocating
fn reserve_exact<T: Ord>(&mut self, n: uint)
Reserve capacity for exactly n elements in the PriorityQueue. Do nothing if the capacity is already sufficient.
fn reserve<T: Ord>(&mut self, n: uint)
Reserve capacity for at least n elements in the PriorityQueue. Do nothing if the capacity is already sufficient.
fn pop<T: Ord>(&mut self) -> Option<T>
Remove the greatest item from a queue and return it, or None if it is
empty.
fn maybe_pop<T: Ord>(&mut self) -> Option<T>
fn push<T: Ord>(&mut self, item: T)
Push an item onto the queue
fn push_pop<T: Ord>(&mut self, item: T) -> T
Optimized version of a push followed by a pop
fn replace<T: Ord>(&mut self, item: T) -> Option<T>
Optimized version of a pop followed by a push. The push is done regardless of whether the queue is empty.
fn into_vec<T: Ord>(self) -> Vec<T>
Consume the PriorityQueue and return the underlying vector
fn into_sorted_vec<T: Ord>(self) -> Vec<T>
Consume the PriorityQueue and return a vector in sorted (ascending) order
fn new<T: Ord>() -> PriorityQueue<T>
Create an empty PriorityQueue
fn with_capacity<T: Ord>(capacity: uint) -> PriorityQueue<T>
Create an empty PriorityQueue with capacity capacity
fn from_vec<T: Ord>(xs: Vec<T>) -> PriorityQueue<T>
Create a PriorityQueue from a vector (heapify)