[−][src]Trait rustc_mir::interpret::AllocMap

pub trait AllocMap<K: Hash + Eq, V> {
    pub fn contains_key<Q: ?Sized + Hash + Eq>(&mut self, k: &Q) -> bool
    where
        K: Borrow<Q>
;
pub fn insert(&mut self, k: K, v: V) -> Option<V>;
pub fn remove<Q: ?Sized + Hash + Eq>(&mut self, k: &Q) -> Option<V>
    where
        K: Borrow<Q>
;
pub fn filter_map_collect<T>(
        &self,
        f: impl FnMut(&K, &V) -> Option<T>
    ) -> Vec<T>;
pub fn get_or<E>(
        &self,
        k: K,
        vacant: impl FnOnce() -> Result<V, E>
    ) -> Result<&V, E>;
pub fn get_mut_or<E>(
        &mut self,
        k: K,
        vacant: impl FnOnce() -> Result<V, E>
    ) -> Result<&mut V, E>; pub fn get(&self, k: K) -> Option<&V> { ... }
pub fn get_mut(&mut self, k: K) -> Option<&mut V> { ... } }

The functionality needed by memory to manage its allocations

Required methods

pub fn contains_key<Q: ?Sized + Hash + Eq>(&mut self, k: &Q) -> bool where
    K: Borrow<Q>, 
[src]

Tests if the map contains the given key. Deliberately takes &mut because that is sufficient, and some implementations can be more efficient then (using RefCell::get_mut).

pub fn insert(&mut self, k: K, v: V) -> Option<V>[src]

Inserts a new entry into the map.

pub fn remove<Q: ?Sized + Hash + Eq>(&mut self, k: &Q) -> Option<V> where
    K: Borrow<Q>, 
[src]

Removes an entry from the map.

pub fn filter_map_collect<T>(
    &self,
    f: impl FnMut(&K, &V) -> Option<T>
) -> Vec<T>
[src]

Returns data based on the keys and values in the map.

pub fn get_or<E>(
    &self,
    k: K,
    vacant: impl FnOnce() -> Result<V, E>
) -> Result<&V, E>
[src]

Returns a reference to entry k. If no such entry exists, call vacant and either forward its error, or add its result to the map and return a reference to that.

pub fn get_mut_or<E>(
    &mut self,
    k: K,
    vacant: impl FnOnce() -> Result<V, E>
) -> Result<&mut V, E>
[src]

Returns a mutable reference to entry k. If no such entry exists, call vacant and either forward its error, or add its result to the map and return a reference to that.

Loading content...

Provided methods

pub fn get(&self, k: K) -> Option<&V>[src]

Read-only lookup.

pub fn get_mut(&mut self, k: K) -> Option<&mut V>[src]

Mutable lookup.

Loading content...

Implementations on Foreign Types

impl<K: Hash + Eq, V> AllocMap<K, V> for FxHashMap<K, V>[src]

Loading content...

Implementors

Loading content...