[−][src]Struct bidirectional_map::Bimap
Implementations
impl<K, V> Bimap<K, V, RandomState> where
K: Eq + Hash + Clone,
V: Eq + Hash + Clone, [src]
K: Eq + Hash + Clone,
V: Eq + Hash + Clone,
impl<K, V, S> Bimap<K, V, S> where
K: Eq + Hash + Clone,
V: Eq + Hash + Clone,
S: BuildHasher + Clone + Default, [src]
K: Eq + Hash + Clone,
V: Eq + Hash + Clone,
S: BuildHasher + Clone + Default,
pub fn with_hasher(hash_builder: S) -> Self[src]
Creates a Bimap with the given hasher.
pub fn from_hash_map(fwd: HashMap<K, V, S>) -> Self[src]
Creates a bimap from a HashMap.
pub fn len(&self) -> usize[src]
Returns the number of elements in the bimap.
pub fn is_empty(&self) -> bool[src]
Returns whether the bimap is empty.
pub fn clear(&mut self)[src]
Removes all elements from the bimap.
pub fn insert(&mut self, k: K, v: V)[src]
Inserts a (key, value) pair into the bimap. Panics if either the key or value is already
present in the bimap; to change a key or value, call either remove_fwd or
remove_rev before inserting the new (key, value) pair.
pub fn fwd(&self) -> &HashMap<K, V, S>[src]
Gets the forward HashMap.
pub fn rev(&self) -> &HashMap<V, K, S>[src]
Gets the reverse HashMap.
pub fn get_fwd<KeyBorrow: ?Sized>(&self, k: &KeyBorrow) -> Option<&V> where
K: Borrow<KeyBorrow>,
KeyBorrow: Hash + Eq, [src]
K: Borrow<KeyBorrow>,
KeyBorrow: Hash + Eq,
Gets the value corresponding to a key.
pub fn get_rev<ValBorrow: ?Sized>(&self, v: &ValBorrow) -> Option<&K> where
V: Borrow<ValBorrow>,
ValBorrow: Hash + Eq, [src]
V: Borrow<ValBorrow>,
ValBorrow: Hash + Eq,
Gets the key corresponding to a value.
pub fn remove_fwd<KeyBorrow: ?Sized>(&mut self, k: &KeyBorrow) -> V where
K: Borrow<KeyBorrow>,
KeyBorrow: Hash + Eq, [src]
K: Borrow<KeyBorrow>,
KeyBorrow: Hash + Eq,
Removes the (key, value) pair with the given key; returns the corresponding value.
pub fn remove_rev<ValBorrow: ?Sized>(&mut self, v: &ValBorrow) -> K where
V: Borrow<ValBorrow>,
ValBorrow: Hash + Eq, [src]
V: Borrow<ValBorrow>,
ValBorrow: Hash + Eq,
Removes the (key, value) pair with the given value; returns the corresponding key.
pub fn contains_fwd<KeyBorrow: ?Sized>(&self, k: &KeyBorrow) -> bool where
K: Borrow<KeyBorrow>,
KeyBorrow: Hash + Eq, [src]
K: Borrow<KeyBorrow>,
KeyBorrow: Hash + Eq,
Returns whether the bimap contains a (key, value) pair with the given key.
pub fn contains_rev<ValBorrow: ?Sized>(&self, v: &ValBorrow) -> bool where
V: Borrow<ValBorrow>,
ValBorrow: Hash + Eq, [src]
V: Borrow<ValBorrow>,
ValBorrow: Hash + Eq,
Returns whether the bimap contains a (key, value) pair with the given value.
pub fn iter(&self) -> Iter<'_, K, V>[src]
Iterates over all (key, value) pairs in the bimap.
Trait Implementations
impl<K: Clone, V: Clone, S: Clone> Clone for Bimap<K, V, S>[src]
impl<K: Debug, V: Debug, S: Debug> Debug for Bimap<K, V, S>[src]
impl<K, V, S> Default for Bimap<K, V, S> where
K: Eq + Hash + Clone,
V: Eq + Hash + Clone,
S: BuildHasher + Clone + Default, [src]
K: Eq + Hash + Clone,
V: Eq + Hash + Clone,
S: BuildHasher + Clone + Default,
Auto Trait Implementations
impl<K, V, S> RefUnwindSafe for Bimap<K, V, S> where
K: RefUnwindSafe,
S: RefUnwindSafe,
V: RefUnwindSafe,
K: RefUnwindSafe,
S: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V, S> Send for Bimap<K, V, S> where
K: Send,
S: Send,
V: Send,
K: Send,
S: Send,
V: Send,
impl<K, V, S> Sync for Bimap<K, V, S> where
K: Sync,
S: Sync,
V: Sync,
K: Sync,
S: Sync,
V: Sync,
impl<K, V, S> Unpin for Bimap<K, V, S> where
K: Unpin,
S: Unpin,
V: Unpin,
K: Unpin,
S: Unpin,
V: Unpin,
impl<K, V, S> UnwindSafe for Bimap<K, V, S> where
K: UnwindSafe,
S: UnwindSafe,
V: UnwindSafe,
K: UnwindSafe,
S: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,