Trait orx_priority_queue::PriorityQueue
source · pub trait PriorityQueue<N, K>where
K: PartialOrd,{
// Required methods
fn len(&self) -> usize;
fn peek(&self) -> Option<&(N, K)>;
fn clear(&mut self);
fn pop(&mut self) -> Option<(N, K)>;
fn pop_node(&mut self) -> Option<N>;
fn pop_key(&mut self) -> Option<K>;
fn push(&mut self, node: N, key: K);
// Provided method
fn is_empty(&self) -> bool { ... }
}
Expand description
A priority queue which allows pushing ([N], [K])=(node, key) pairs to the collection, and popping the foremost element having the lowest key.
Required Methods§
sourcefn peek(&self) -> Option<&(N, K)>
fn peek(&self) -> Option<&(N, K)>
Returns, without popping, a reference to the foremost element of the queue; returns None if the queue is empty.
sourcefn pop(&mut self) -> Option<(N, K)>
fn pop(&mut self) -> Option<(N, K)>
Removes and returns the (node, key) pair with the lowest key in the queue; returns None if the queue is empty.
sourcefn pop_node(&mut self) -> Option<N>
fn pop_node(&mut self) -> Option<N>
Removes and returns the node with the lowest key in the queue; returns None if the queue is empty.