pub struct VecMap<K, V>(Vec<(K, V)>);Expand description
A small map backed by an unsorted vector.
Maintains key uniqueness at cost of O(n) lookup/insert/remove. Maintains insertion order
(insert calls that overwrite an existing value don’t change order).
Tuple Fields§
§0: Vec<(K, V)>Implementations§
Source§impl<K: Eq, V> VecMap<K, V>
impl<K: Eq, V> VecMap<K, V>
pub fn new() -> Self
pub fn is_empty(&self) -> bool
pub fn clear(&mut self)
fn find(&self, key: &K) -> Option<usize>
pub fn contains(&self, key: &K) -> bool
pub fn get(&self, key: &K) -> Option<&V>
pub fn get_mut(&mut self, key: &K) -> Option<&mut V>
pub fn insert(&mut self, key: K, value: V) -> Option<V>
pub fn remove(&mut self, key: &K) -> Option<V>
pub fn values(&self) -> impl Iterator<Item = &V>
Trait Implementations§
Auto Trait Implementations§
impl<K, V> Freeze for VecMap<K, V>
impl<K, V> RefUnwindSafe for VecMap<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for VecMap<K, V>
impl<K, V> Sync for VecMap<K, V>
impl<K, V> Unpin for VecMap<K, V>
impl<K, V> UnwindSafe for VecMap<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