Struct radix_heap::RadixHeapMap
[−]
[src]
pub struct RadixHeapMap<K, V> { /* fields omitted */ }
A montone priority queue implemented with a radix heap.
This will be a max-heap.
It is a logic error for a key to be modified in such a way that the
item's ordering relative to any other item, as determined by the Ord
trait, changes while it is in the heap. This is normally only possible
through Cell
, RefCell
, global state, I/O, or unsafe code.
Methods
impl<K: Radix + Ord + Copy, V> RadixHeapMap<K, V>
[src]
pub fn new() -> RadixHeapMap<K, V>
[src]
Create an empty RadixHeapMap
pub fn new_at(top: K) -> RadixHeapMap<K, V>
[src]
Create an empty RadixHeapMap
with the top key set to a specific
value.
This can be more efficient if you have a known minimum bound of the items being pushed to the heap.
pub fn clear(&mut self)
[src]
Drops all items form the RadixHeapMap
and sets the top key to None
.
pub fn clear_to(&mut self, top: K)
[src]
Drop all items from the RadixHeapMap
and sets the top key to a
specific value.
This can be more efficient if you have a known minimum bound of the items being pushed to the heap.
pub fn push(&mut self, key: K, value: V)
[src]
Pushes a new key value pair onto the heap.
Panics
Panics if the key is more than the current top key.
pub fn constrain(&mut self)
[src]
Sets the top value to the current maximum key value in the heap
pub fn pop(&mut self) -> Option<(K, V)>
[src]
Pops the largest element of the heap. This may increase the top value.
pub fn len(&self) -> usize
[src]
Returns the number of elements in the heap
pub fn is_empty(&self) -> bool
[src]
Returns true if there is no elements in the heap
pub fn top(&self) -> Option<K>
[src]
The current top value. All keys pushed onto the heap must be smaller than this value.
pub fn shrink_to_fit(&mut self)
[src]
Discards as much additional capacity as possible.
Trait Implementations
impl<K: Clone, V: Clone> Clone for RadixHeapMap<K, V>
[src]
fn clone(&self) -> RadixHeapMap<K, V>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<K: Radix + Ord + Copy, V> Default for RadixHeapMap<K, V>
[src]
fn default() -> RadixHeapMap<K, V>
[src]
Returns the "default value" for a type. Read more
impl<K: Radix + Ord + Copy, V> FromIterator<(K, V)> for RadixHeapMap<K, V>
[src]
fn from_iter<I>(iter: I) -> RadixHeapMap<K, V> where
I: IntoIterator<Item = (K, V)>,
[src]
I: IntoIterator<Item = (K, V)>,
Creates a value from an iterator. Read more
impl<K: Radix + Ord + Copy, V> Extend<(K, V)> for RadixHeapMap<K, V>
[src]
fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = (K, V)>,
[src]
I: IntoIterator<Item = (K, V)>,
Extends a collection with the contents of an iterator. Read more
impl<'a, K: Radix + Ord + Copy + 'a, V: Copy + 'a> Extend<&'a (K, V)> for RadixHeapMap<K, V>
[src]
fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = &'a (K, V)>,
[src]
I: IntoIterator<Item = &'a (K, V)>,
Extends a collection with the contents of an iterator. Read more
impl<K: Debug, V: Debug> Debug for RadixHeapMap<K, V>
[src]
Auto Trait Implementations
impl<K, V> Send for RadixHeapMap<K, V> where
K: Send,
V: Send,
K: Send,
V: Send,
impl<K, V> Sync for RadixHeapMap<K, V> where
K: Sync,
V: Sync,
K: Sync,
V: Sync,