Struct 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<'a>(&'a self) -> Items<'a, T>
An iterator visiting all values in underlying vector, in arbitrary order.
fn top<'a>(&'a self) -> Option<&'a T>
Returns the greatest item in a queue or None if it is empty
fn maybe_top<'a>(&'a self) -> Option<&'a T>
fn capacity(&self) -> uint
Returns the number of elements the queue can hold without reallocating
fn reserve_exact(&mut self, n: uint)
Reserve capacity for exactly n elements in the PriorityQueue. Do nothing if the capacity is already sufficient.
fn reserve(&mut self, n: uint)
Reserve capacity for at least n elements in the PriorityQueue. Do nothing if the capacity is already sufficient.
fn pop(&mut self) -> Option<T>
Remove the greatest item from a queue and return it, or None if it is
empty.
fn maybe_pop(&mut self) -> Option<T>
fn push(&mut self, item: T)
Push an item onto the queue
fn push_pop(&mut self, item: T) -> T
Optimized version of a push followed by a pop
fn replace(&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(self) -> Vec<T>
Consume the PriorityQueue and return the underlying vector
fn into_sorted_vec(self) -> Vec<T>
Consume the PriorityQueue and return a vector in sorted (ascending) order
fn new() -> PriorityQueue<T>
Create an empty PriorityQueue
fn with_capacity(capacity: uint) -> PriorityQueue<T>
Create an empty PriorityQueue with capacity capacity
fn from_vec(xs: Vec<T>) -> PriorityQueue<T>
Create a PriorityQueue from a vector (heapify)
Trait Implementations
impl<T: Ord> Collection for PriorityQueue<T>
impl<T: Ord> Mutable for PriorityQueue<T>
fn clear(&mut self)
Drop all items from the queue