Struct btlib::collections::bijection::Bijection
source · pub struct Bijection<K, V> { /* private fields */ }
Expand description
Implements a bijection (one-to-one function) between a set of keys and a set of values. Mapping from key to value and from value to key are both O(1) operations.
Implementations§
source§impl<K, V> Bijection<K, V>
impl<K, V> Bijection<K, V>
sourcepub fn new(default_key: K, default_value: V) -> Self
pub fn new(default_key: K, default_value: V) -> Self
Creates a new Bijection with the given default key and value.
sourcepub fn k2v(&self) -> &HashMapWithDefault<K, V>
pub fn k2v(&self) -> &HashMapWithDefault<K, V>
Returns a reference to the hash table which maps keys to values.
sourcepub fn v2k(&self) -> &HashMapWithDefault<V, K>
pub fn v2k(&self) -> &HashMapWithDefault<V, K>
Returns a reference to the hash table which maps values to keys.
Auto Trait Implementations§
impl<K, V> RefUnwindSafe for Bijection<K, V>where K: RefUnwindSafe, V: RefUnwindSafe,
impl<K, V> Send for Bijection<K, V>where K: Send, V: Send,
impl<K, V> Sync for Bijection<K, V>where K: Sync, V: Sync,
impl<K, V> Unpin for Bijection<K, V>where K: Unpin, V: Unpin,
impl<K, V> UnwindSafe for Bijection<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