[−][src]Trait rustc_mir::interpret::AllocMap
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]
K: Borrow<Q>,
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]
K: Borrow<Q>,
Removes an entry from the map.
pub fn filter_map_collect<T>(
&self,
f: impl FnMut(&K, &V) -> Option<T>
) -> Vec<T>[src]
&self,
f: impl FnMut(&K, &V) -> Option<T>
) -> Vec<T>
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]
&self,
k: K,
vacant: impl FnOnce() -> Result<V, E>
) -> Result<&V, E>
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]
&mut self,
k: K,
vacant: impl FnOnce() -> Result<V, E>
) -> Result<&mut V, E>
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.
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.
Implementations on Foreign Types
impl<K: Hash + Eq, V> AllocMap<K, V> for FxHashMap<K, V>[src]
pub fn contains_key<Q: ?Sized + Hash + Eq>(&mut self, k: &Q) -> bool where
K: Borrow<Q>, [src]
K: Borrow<Q>,
pub fn insert(&mut self, k: K, v: V) -> Option<V>[src]
pub fn remove<Q: ?Sized + Hash + Eq>(&mut self, k: &Q) -> Option<V> where
K: Borrow<Q>, [src]
K: Borrow<Q>,
pub fn filter_map_collect<T>(
&self,
f: impl FnMut(&K, &V) -> Option<T>
) -> Vec<T>[src]
&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>[src]
&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>[src]
&mut self,
k: K,
vacant: impl FnOnce() -> Result<V, E>
) -> Result<&mut V, E>