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)

Trait Implementations

impl<T: Ord> Collection for PriorityQueue<T>

fn len<T: Ord>(&self) -> uint

Returns the length of the queue

fn is_empty<T: Ord>(&self) -> bool

impl<T: Ord> Mutable for PriorityQueue<T>

fn clear<T: Ord>(&mut self)

Drop all items from the queue

impl<T: Ord> Default for PriorityQueue<T>

fn default<T: Ord>() -> PriorityQueue<T>

impl<T: Ord> FromIterator<T> for PriorityQueue<T>

fn from_iter<Iter: Iterator<T>>(iter: Iter) -> PriorityQueue<T>

impl<T: Ord> Extendable<T> for PriorityQueue<T>

fn extend<Iter: Iterator<T>>(&mut self, iter: Iter)

Derived Implementations

impl<T: Clone> Clone for PriorityQueue<T>

fn clone<T: Clone>(&self) -> PriorityQueue<T>

fn clone_from<T: Clone>(&mut self, &PriorityQueue<T>)