[][src]Struct gluon_base::scoped_map::ScopedMap

pub struct ScopedMap<K: Eq + Hash, 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

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]

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]

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]

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]

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]

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]

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>

Notable traits for Iter<'a, K, V>

impl<'a, K, V> Iterator for Iter<'a, K, V> where
    K: 'a,
    V: 'a, 
type Item = (&'a K, &'a V);
[src]

Trait Implementations

impl<K, V> Debug for ScopedMap<K, V> where
    K: Eq + Hash + Debug + Clone,
    V: Debug
[src]

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]

Auto Trait Implementations

impl<K, V> RefUnwindSafe for ScopedMap<K, V> where
    K: RefUnwindSafe,
    V: RefUnwindSafe

impl<K, V> Send for ScopedMap<K, V> where
    K: Send,
    V: Send

impl<K, V> Sync for ScopedMap<K, V> where
    K: Sync,
    V: Sync

impl<K, V> Unpin for ScopedMap<K, V> where
    K: Unpin,
    V: Unpin

impl<K, V> UnwindSafe for ScopedMap<K, V> where
    K: UnwindSafe,
    V: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<Id> AsId<Id> for Id where
    Id: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.