pub struct NameMap<V> { /* private fields */ }Expand description
A mapping from Name to V.
Wraps HashMap<Name, V> for convenient use in the elaborator and kernel.
Implementations§
Source§impl<V> NameMap<V>
impl<V> NameMap<V>
Sourcepub fn with_capacity(cap: usize) -> Self
pub fn with_capacity(cap: usize) -> Self
Create a NameMap with the given capacity.
Sourcepub fn get_mut(&mut self, name: &Name) -> Option<&mut V>
pub fn get_mut(&mut self, name: &Name) -> Option<&mut V>
Get a mutable reference to the value for name.
Sourcepub fn contains_key(&self, name: &Name) -> bool
pub fn contains_key(&self, name: &Name) -> bool
Check whether name has a mapping.
Sourcepub fn filter_by_namespace(&self, ns: &Name) -> Vec<(&Name, &V)>
pub fn filter_by_namespace(&self, ns: &Name) -> Vec<(&Name, &V)>
Filter entries by a predicate on the name.
Sourcepub fn sorted_names(&self) -> Vec<Name>
pub fn sorted_names(&self) -> Vec<Name>
Collect all names in sorted order.
Sourcepub fn entry_or_insert(&mut self, name: Name, value: V) -> &mut V
pub fn entry_or_insert(&mut self, name: Name, value: V) -> &mut V
Get or insert a default value.
Trait Implementations§
Auto Trait Implementations§
impl<V> Freeze for NameMap<V>
impl<V> RefUnwindSafe for NameMap<V>where
V: RefUnwindSafe,
impl<V> Send for NameMap<V>where
V: Send,
impl<V> Sync for NameMap<V>where
V: Sync,
impl<V> Unpin for NameMap<V>where
V: Unpin,
impl<V> UnsafeUnpin for NameMap<V>
impl<V> UnwindSafe for NameMap<V>where
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