[−][src]Struct gluon_base::scoped_map::ScopedMap
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]
pub fn new() -> ScopedMap<K, V>
[src]
pub fn num_scopes(&self) -> usize
[src]
pub fn enter_scope(&mut self)
[src]
Introduces a new scope
pub fn current_scope(
&self
) -> impl Iterator<Item = (&K, &V)>
[src]
&self
) -> impl Iterator<Item = (&K, &V)>
ⓘImportant traits for ExitScopeIter<'a, K, V>pub fn exit_scope(&mut self) -> ExitScopeIter<K, V>
[src]
Exits the current scope, returning an iterator over the (key, value) pairs that are removed
When ExitScopeIter
is dropped any remaining pairs of the scope is removed as well.
pub fn remove<Q>(&mut self, k: &Q) -> bool where
K: Borrow<Q>,
Q: Eq + Hash,
K: Debug,
V: Debug,
[src]
K: Borrow<Q>,
Q: Eq + Hash,
K: Debug,
V: Debug,
Removes a previously inserted value from the map.
pub fn in_current_scope<Q>(&self, k: &Q) -> bool where
K: Borrow<Q>,
Q: Eq + Hash,
[src]
K: Borrow<Q>,
Q: Eq + Hash,
Returns true if the key has a value declared in the last declared scope
pub fn get<'a, Q: ?Sized>(&'a self, k: &Q) -> Option<&'a V> where
K: Borrow<Q>,
Q: Eq + Hash,
[src]
K: Borrow<Q>,
Q: Eq + Hash,
Returns a reference to the last inserted value corresponding to the key
pub fn get_all<'a, Q: ?Sized>(&'a self, k: &Q) -> Option<&'a [V]> where
K: Borrow<Q>,
Q: Eq + Hash,
[src]
K: Borrow<Q>,
Q: Eq + Hash,
Returns a reference to the all inserted value corresponding to the key
pub fn entry(&mut self, key: K) -> Entry<K, V>
[src]
pub fn contains_key<'a, Q: ?Sized>(&'a self, k: &Q) -> bool where
K: Borrow<Q>,
Q: Eq + Hash,
[src]
K: Borrow<Q>,
Q: Eq + Hash,
pub fn len(&self) -> usize
[src]
Returns the number of elements in the container. Shadowed elements are not counted
pub fn full_len(&self) -> usize
[src]
Returns the number of elements in the container. Shadowed elements are counted
pub fn is_empty(&self) -> bool
[src]
Returns true if this map is empty
pub fn clear(&mut self)
[src]
Removes all elements
pub fn swap(&mut self, k: K, v: V) -> Option<V>
[src]
Swaps the value stored at key, or inserts it if it is not present
pub fn pop(&mut self, k: &K) -> Option<V>
[src]
pub fn get_mut<'a>(&'a mut self, key: &K) -> Option<&'a mut V>
[src]
pub fn insert(&mut self, k: K, v: V) -> bool
[src]
impl<K: Eq + Hash, V> ScopedMap<K, V>
[src]
pub fn iter_mut(&mut self) -> IterMut<K, Vec<V>>
[src]
Returns an iterator of the (key, values) pairs inserted in the map
ⓘImportant traits for Iter<'a, K, V>pub fn iter(&self) -> Iter<K, V>
[src]
Trait Implementations
impl<K: Eq + Hash + Clone, V> Extend<(K, V)> for ScopedMap<K, V>
[src]
fn extend<T>(&mut self, iter: T) where
T: IntoIterator<Item = (K, V)>,
[src]
T: IntoIterator<Item = (K, V)>,
impl<K: Eq + Hash, V> Default for ScopedMap<K, V>
[src]
impl<K, V> Debug for ScopedMap<K, V> where
K: Eq + Hash + Debug + Clone,
V: Debug,
[src]
K: Eq + Hash + Debug + Clone,
V: Debug,
Auto Trait Implementations
impl<K, V> Send for ScopedMap<K, V> where
K: Send,
V: Send,
K: Send,
V: Send,
impl<K, V> Sync for ScopedMap<K, V> where
K: Sync,
V: Sync,
K: Sync,
V: Sync,
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,