pub struct HeapMap<K: Hash + Eq + Copy + Debug, V: Eq + Ord + Clone> { /* private fields */ }
Expand description
The HeapMap
maintain a max heap along with a hash map to support
additional remove
and update
operations.
Implementations§
source§impl<K: Hash + Eq + Copy + Debug, V: Eq + Ord + Clone> HeapMap<K, V>
impl<K: Hash + Eq + Copy + Debug, V: Eq + Ord + Clone> HeapMap<K, V>
pub fn new() -> Self
sourcepub fn insert(&mut self, key: &K, value: V) -> Option<V>
pub fn insert(&mut self, key: &K, value: V) -> Option<V>
Insert a K-V into the HeapMap.
Return the old value if key
already exist. Return None
otherwise.
sourcepub fn update_with<F>(&mut self, key: &K, update_fn: F)
pub fn update_with<F>(&mut self, key: &K, update_fn: F)
In-place update some fields of a node’s value.
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
pub fn iter(&self) -> impl Iterator<Item = V> + '_
Trait Implementations§
Auto Trait Implementations§
impl<K, V> RefUnwindSafe for HeapMap<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for HeapMap<K, V>
impl<K, V> Sync for HeapMap<K, V>
impl<K, V> Unpin for HeapMap<K, V>
impl<K, V> UnwindSafe for HeapMap<K, V>where
K: UnwindSafe,
V: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more