pub struct BiMap<K, V> { /* private fields */ }Expand description
An ordered, deduplicated collection of key-value pairs with unique values.
Implementations§
Source§impl<K, V> BiMap<K, V>
impl<K, V> BiMap<K, V>
Sourcepub fn position(&self, key: &K) -> Option<usize>where
K: Ord,
pub fn position(&self, key: &K) -> Option<usize>where
K: Ord,
Returns the position of the provided key, if it exists.
Sourcepub fn value(&self, index: usize) -> Option<&V>
pub fn value(&self, index: usize) -> Option<&V>
Returns the associated value at index, if it exists.
Sourcepub fn get_value(&self, key: &K) -> Option<&V>where
K: Ord,
pub fn get_value(&self, key: &K) -> Option<&V>where
K: Ord,
Returns the associated value for key, if it exists.
Sourcepub fn get_key(&self, value: &V) -> Option<&K>where
V: PartialEq,
pub fn get_key(&self, value: &V) -> Option<&K>where
V: PartialEq,
Returns the associated key for value, if it exists.
Sourcepub fn iter_pairs(&self) -> impl Iterator<Item = (&K, &V)>
pub fn iter_pairs(&self) -> impl Iterator<Item = (&K, &V)>
Returns a zipped iterator over keys and values.
Methods from Deref<Target = Set<K>>§
Trait Implementations§
Source§impl<K: EncodeSize, V: EncodeSize> EncodeSize for BiMap<K, V>
impl<K: EncodeSize, V: EncodeSize> EncodeSize for BiMap<K, V>
Source§fn encode_size(&self) -> usize
fn encode_size(&self) -> usize
Returns the encoded size of this value (in bytes).
Source§impl<'a, K, V> IntoIterator for &'a BiMap<K, V>
impl<'a, K, V> IntoIterator for &'a BiMap<K, V>
Source§impl<K, V> IntoIterator for BiMap<K, V>
impl<K, V> IntoIterator for BiMap<K, V>
Source§impl<K: Read + Ord, V: Eq + Hash + Read> Read for BiMap<K, V>
impl<K: Read + Ord, V: Eq + Hash + Read> Read for BiMap<K, V>
Source§impl<K: Ord + Clone, V: Clone + Eq + Hash, const N: usize> TryFrom<&[(K, V); N]> for BiMap<K, V>
impl<K: Ord + Clone, V: Clone + Eq + Hash, const N: usize> TryFrom<&[(K, V); N]> for BiMap<K, V>
impl<K: Eq, V: Eq> Eq for BiMap<K, V>
impl<K, V> StructuralPartialEq for BiMap<K, V>
Auto Trait Implementations§
impl<K, V> Freeze for BiMap<K, V>
impl<K, V> RefUnwindSafe for BiMap<K, V>where
V: RefUnwindSafe,
K: RefUnwindSafe,
impl<K, V> Send for BiMap<K, V>
impl<K, V> Sync for BiMap<K, V>
impl<K, V> Unpin for BiMap<K, V>
impl<K, V> UnwindSafe for BiMap<K, V>where
V: UnwindSafe,
K: UnwindSafe,
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)