[−][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
Implementations
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]
pub fn exit_scope(&mut self) -> ExitScopeIter<'_, K, V>ⓘNotable traits for ExitScopeIter<'a, K, V>
impl<'a, K, V> Iterator for ExitScopeIter<'a, K, V> where
K: Eq + Hash + Clone, type Item = (K, V);
[src]
Notable traits for ExitScopeIter<'a, K, V>
impl<'a, K, V> Iterator for ExitScopeIter<'a, K, V> where
K: Eq + Hash + Clone, type Item = (K, V);
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: ?Sized>(&mut self, k: &Q) -> Option<V> 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]
pub fn into_iter(self) -> impl Iterator<Item = (K, V)>
[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
pub fn iter(&self) -> Iter<'_, K, V>ⓘ
[src]
Trait Implementations
impl<K, V> Debug for ScopedMap<K, V> where
K: Eq + Hash + Debug + Clone,
V: Debug,
[src]
K: Eq + Hash + Debug + Clone,
V: Debug,
impl<K: Eq + Hash, V> Default for ScopedMap<K, V>
[src]
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)>,
fn extend_one(&mut self, item: A)
[src]
fn extend_reserve(&mut self, additional: usize)
[src]
Auto Trait Implementations
impl<K, V> RefUnwindSafe for ScopedMap<K, V> where
K: RefUnwindSafe,
V: RefUnwindSafe,
K: RefUnwindSafe,
V: RefUnwindSafe,
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,
impl<K, V> Unpin for ScopedMap<K, V> where
K: Unpin,
V: Unpin,
K: Unpin,
V: Unpin,
impl<K, V> UnwindSafe for ScopedMap<K, V> where
K: UnwindSafe,
V: UnwindSafe,
K: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<Id> AsId<Id> for Id where
Id: ?Sized,
[src]
Id: ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
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, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,