pub struct ScopeTable<K, V> { /* private fields */ }Expand description
A scoped symbol table supporting nested scopes.
Each push_scope / pop_scope pair delimits a lexical scope. Lookups
search from the innermost scope outward.
Implementations§
Source§impl<K: Eq, V: Clone> ScopeTable<K, V>
impl<K: Eq, V: Clone> ScopeTable<K, V>
Sourcepub fn push_scope(&mut self)
pub fn push_scope(&mut self)
Push a new nested scope.
Sourcepub fn pop_scope(&mut self)
pub fn pop_scope(&mut self)
Pop the innermost scope, discarding its bindings. Panics if called on the root scope.
Sourcepub fn lookup(&self, key: &K) -> Option<&V>
pub fn lookup(&self, key: &K) -> Option<&V>
Look up key, searching from innermost to outermost scope.
Sourcepub fn defined_locally(&self, key: &K) -> bool
pub fn defined_locally(&self, key: &K) -> bool
Return true if key is defined in the current scope only.
Trait Implementations§
Auto Trait Implementations§
impl<K, V> Freeze for ScopeTable<K, V>
impl<K, V> RefUnwindSafe for ScopeTable<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for ScopeTable<K, V>
impl<K, V> Sync for ScopeTable<K, V>
impl<K, V> Unpin for ScopeTable<K, V>
impl<K, V> UnsafeUnpin for ScopeTable<K, V>
impl<K, V> UnwindSafe for ScopeTable<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