Struct move_lang::shared::unique_map::UniqueMap
source · pub struct UniqueMap<K: TName, V>(_);
Expand description
Unique wrapper around BTreeMap
that throws on duplicate inserts
Implementations§
source§impl<K: TName, V> UniqueMap<K, V>
impl<K: TName, V> UniqueMap<K, V>
pub fn new() -> Self
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
pub fn add(&mut self, key: K, value: V) -> Result<(), (K, K::Loc)>
pub fn contains_key(&self, key: &K) -> bool
pub fn contains_key_(&self, key_: &K::Key) -> bool
pub fn get(&self, key: &K) -> Option<&V>
pub fn get_(&self, key_: &K::Key) -> Option<&V>
pub fn get_mut(&mut self, key: &K) -> Option<&mut V>
pub fn get_mut_(&mut self, key_: &K::Key) -> Option<&mut V>
pub fn get_loc(&self, key: &K) -> Option<&K::Loc>
pub fn get_loc_(&self, key_: &K::Key) -> Option<&K::Loc>
pub fn remove(&mut self, key: &K) -> Option<V>
pub fn remove_(&mut self, key_: &K::Key) -> Option<V>
pub fn map<V2, F>(self, f: F) -> UniqueMap<K, V2>where F: FnMut(K, V) -> V2,
pub fn filter_map<V2, F>(self, f: F) -> UniqueMap<K, V2>where F: FnMut(K, V) -> Option<V2>,
pub fn ref_map<V2, F>(&self, f: F) -> UniqueMap<K, V2>where F: FnMut(K, &V) -> V2,
pub fn union_with<F>(&self, other: &Self, f: F) -> Selfwhere V: Clone, F: FnMut(&K, &V, &V) -> V,
pub fn iter(&self) -> Iter<'_, K, V> ⓘ
pub fn key_cloned_iter(&self) -> impl Iterator<Item = (K, &V)>
pub fn iter_mut(&mut self) -> IterMut<'_, K, V> ⓘ
pub fn maybe_from_opt_iter( iter: impl Iterator<Item = Option<(K, V)>> ) -> Option<Result<UniqueMap<K, V>, (K::Key, K::Loc, K::Loc)>>
pub fn maybe_from_iter( iter: impl Iterator<Item = (K, V)> ) -> Result<UniqueMap<K, V>, (K::Key, K::Loc, K::Loc)>
Trait Implementations§
source§impl<K: Clone + TName, V: Clone> Clone for UniqueMap<K, V>where
K::Key: Clone,
K::Loc: Clone,
impl<K: Clone + TName, V: Clone> Clone for UniqueMap<K, V>where K::Key: Clone, K::Loc: Clone,
source§impl<K: Debug + TName, V: Debug> Debug for UniqueMap<K, V>where
K::Key: Debug,
K::Loc: Debug,
impl<K: Debug + TName, V: Debug> Debug for UniqueMap<K, V>where K::Key: Debug, K::Loc: Debug,
source§impl<K: Default + TName, V: Default> Default for UniqueMap<K, V>where
K::Key: Default,
K::Loc: Default,
impl<K: Default + TName, V: Default> Default for UniqueMap<K, V>where K::Key: Default, K::Loc: Default,
source§impl<'a, K: TName, V> IntoIterator for &'a UniqueMap<K, V>
impl<'a, K: TName, V> IntoIterator for &'a UniqueMap<K, V>
source§impl<'a, K: TName, V> IntoIterator for &'a mut UniqueMap<K, V>
impl<'a, K: TName, V> IntoIterator for &'a mut UniqueMap<K, V>
source§impl<K: TName, V> IntoIterator for UniqueMap<K, V>
impl<K: TName, V> IntoIterator for UniqueMap<K, V>
source§impl<K: TName, V: Ord> Ord for UniqueMap<K, V>
impl<K: TName, V: Ord> Ord for UniqueMap<K, V>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<K: TName, V: PartialEq> PartialEq<UniqueMap<K, V>> for UniqueMap<K, V>
impl<K: TName, V: PartialEq> PartialEq<UniqueMap<K, V>> for UniqueMap<K, V>
source§impl<K: TName, V: PartialOrd> PartialOrd<UniqueMap<K, V>> for UniqueMap<K, V>
impl<K: TName, V: PartialOrd> PartialOrd<UniqueMap<K, V>> for UniqueMap<K, V>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl<K: TName, V: Eq> Eq for UniqueMap<K, V>
Auto Trait Implementations§
impl<K, V> RefUnwindSafe for UniqueMap<K, V>where V: RefUnwindSafe, <K as TName>::Key: RefUnwindSafe, <K as TName>::Loc: RefUnwindSafe,
impl<K, V> Send for UniqueMap<K, V>where V: Send, <K as TName>::Key: Send, <K as TName>::Loc: Send,
impl<K, V> Sync for UniqueMap<K, V>where V: Sync, <K as TName>::Key: Sync, <K as TName>::Loc: Sync,
impl<K, V> Unpin for UniqueMap<K, V>
impl<K, V> UnwindSafe for UniqueMap<K, V>where V: RefUnwindSafe, <K as TName>::Key: RefUnwindSafe, <K as TName>::Loc: RefUnwindSafe,
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.