pub struct StackMap<K: PartialEq + Clone, V: Clone> { /* private fields */ }Expand description
A map supporting scoped bindings with push/pop semantics.
Useful for implementing the typing context in the elaborator, where entering a binder pushes a new scope and exiting pops it.
Implementations§
Source§impl<K: PartialEq + Clone, V: Clone> StackMap<K, V>
impl<K: PartialEq + Clone, V: Clone> StackMap<K, V>
Sourcepub fn push_scope(&mut self)
pub fn push_scope(&mut self)
Push a new scope.
Sourcepub fn get(&self, key: &K) -> Option<&V>
pub fn get(&self, key: &K) -> Option<&V>
Look up by key, searching from innermost to outermost scope.
Sourcepub fn contains_key(&self, key: &K) -> bool
pub fn contains_key(&self, key: &K) -> bool
Check if a key is visible in any scope.
Sourcepub fn total_bindings(&self) -> usize
pub fn total_bindings(&self) -> usize
Total number of bindings across all scopes.
Trait Implementations§
Auto Trait Implementations§
impl<K, V> Freeze for StackMap<K, V>
impl<K, V> RefUnwindSafe for StackMap<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for StackMap<K, V>
impl<K, V> Sync for StackMap<K, V>
impl<K, V> Unpin for StackMap<K, V>
impl<K, V> UnsafeUnpin for StackMap<K, V>
impl<K, V> UnwindSafe for StackMap<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