Struct gluon_base::scoped_map::ScopedMap
[−]
[src]
pub struct ScopedMap<K: Eq + Hash + Clone, V> { /* fields omitted */ }
A map struct which allows for the introduction of different scopes Introducing a new scope will make it possible to introduce additional variables with names already defined, shadowing the old name After exiting a scope the shadowed variable will again be re introduced
Methods
impl<K: Eq + Hash + Clone, V> ScopedMap<K, V>
[src]
fn new() -> ScopedMap<K, V>
fn enter_scope(&mut self)
Introduces a new scope
fn exit_scope(&mut self)
Exits the current scope, removing anything inserted since the matching enter_scope call
fn remove(&mut self, k: &K) -> bool
Removes a previusly inserted value from the map.
fn in_current_scope(&self, k: &K) -> bool
Returns true if the key has a value declared in the last declared scope
fn iter_mut(&mut self) -> IterMut<K, Vec<V>>
Returns an iterator of the (key, values) pairs inserted in the map
fn get<'a, Q: ?Sized>(&'a self, k: &Q) -> Option<&'a V> where K: Borrow<Q>, Q: Eq + Hash
Returns a reference to the last inserted value corresponding to the key
fn get_all<'a, Q: ?Sized>(&'a self, k: &Q) -> Option<&'a [V]> where K: Borrow<Q>, Q: Eq + Hash
Returns a reference to the all inserted value corresponding to the key
fn len(&self) -> usize
Returns the number of elements in the container. Shadowed elements are not counted
fn is_empty(&self) -> bool
Returns true if this map is empty
fn clear(&mut self)
Removes all elements
fn swap(&mut self, k: K, v: V) -> Option<V>
Swaps the value stored at key, or inserts it if it is not present