pub struct FlatMap<K: Eq, V> { /* private fields */ }Expand description
Linear Map with no sorting guarantee and no duplicate entries
Implementations§
Source§impl<K, V> FlatMap<K, V>where
K: Eq,
impl<K, V> FlatMap<K, V>where
K: Eq,
pub fn new() -> Self
pub fn with_capacity(capacity: usize) -> Self
Sourcepub fn from_entries(iter: impl Iterator<Item = FlatMapEntry<K, V>>) -> Self
pub fn from_entries(iter: impl Iterator<Item = FlatMapEntry<K, V>>) -> Self
inserts entries by checking for duplicates for every item if duplicate items are found, last one stays while earlier gets discarded not recommended for large list of entries, check for duplicates yourself and use FlatMap::from_entries_unchecked
Sourcepub unsafe fn from_entries_unchecked(
iter: impl Iterator<Item = FlatMapEntry<K, V>>,
) -> Self
pub unsafe fn from_entries_unchecked( iter: impl Iterator<Item = FlatMapEntry<K, V>>, ) -> Self
construct inner vec without checking for duplicates
pub fn get(&self, k: &K) -> Option<&V>
pub fn insert(&mut self, k: K, v: V) -> Option<V>
pub fn delete(&mut self, k: &K) -> Option<V>
pub fn iter(&self) -> impl Iterator<Item = &FlatMapEntry<K, V>>
pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut FlatMapEntry<K, V>>
pub fn shrink_to_fit(&mut self)
Trait Implementations§
Source§impl<K: Eq, V> IntoIterator for FlatMap<K, V>
impl<K: Eq, V> IntoIterator for FlatMap<K, V>
Auto Trait Implementations§
impl<K, V> Freeze for FlatMap<K, V>
impl<K, V> RefUnwindSafe for FlatMap<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for FlatMap<K, V>
impl<K, V> Sync for FlatMap<K, V>
impl<K, V> Unpin for FlatMap<K, V>
impl<K, V> UnsafeUnpin for FlatMap<K, V>
impl<K, V> UnwindSafe for FlatMap<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