[][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

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]

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]

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]

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]

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]

Auto Trait Implementations

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

Blanket Implementations

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

impl<T> From for T[src]

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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