pub type DenseRefIndexMap<'a, K, V> = DenseIndexMap<'a, K, V, RefFamily<'a>>;
Expand description
DenseIndexMap
specialized to the RefFamily
.
Aliased Type§
struct DenseRefIndexMap<'a, K, V> { /* private fields */ }
Implementations
Source§impl<'a, K, V, P> DenseIndexMap<'a, K, V, P>where
K: IndexedValue + 'a,
P: PointerFamily<'a>,
impl<'a, K, V, P> DenseIndexMap<'a, K, V, P>where
K: IndexedValue + 'a,
P: PointerFamily<'a>,
Sourcepub fn new(
domain: &P::Pointer<IndexedDomain<K>>,
mk_elem: impl FnMut(K::Index) -> V,
) -> Self
pub fn new( domain: &P::Pointer<IndexedDomain<K>>, mk_elem: impl FnMut(K::Index) -> V, ) -> Self
Constructs a new map with an initial element of mk_elem(i)
for each i
in domain
.
Sourcepub fn get<M>(&self, idx: impl ToIndex<K, M>) -> Option<&V>
pub fn get<M>(&self, idx: impl ToIndex<K, M>) -> Option<&V>
Returns an immutable reference to a value for a given key if it exists.
Sourcepub fn get_mut<M>(&mut self, idx: impl ToIndex<K, M>) -> Option<&mut V>
pub fn get_mut<M>(&mut self, idx: impl ToIndex<K, M>) -> Option<&mut V>
Returns a mutable reference to a value for a given key if it exists.
Sourcepub unsafe fn get_unchecked<M>(&self, idx: impl ToIndex<K, M>) -> &V
pub unsafe fn get_unchecked<M>(&self, idx: impl ToIndex<K, M>) -> &V
Returns a reference to a value for a given key.
§Safety
This function has undefined behavior if key
is not in self
.
Sourcepub unsafe fn get_unchecked_mut<M>(&mut self, idx: impl ToIndex<K, M>) -> &mut V
pub unsafe fn get_unchecked_mut<M>(&mut self, idx: impl ToIndex<K, M>) -> &mut V
Returns a mutable reference to a value for a given key.
§Safety
This function has undefined behavior if key
is not in self
.
Trait Implementations
Source§impl<'a, K, V, P, M, U> FromIndexicalIterator<'a, K, P, M, (U, V)> for DenseIndexMap<'a, K, V, P>
impl<'a, K, V, P, M, U> FromIndexicalIterator<'a, K, P, M, (U, V)> for DenseIndexMap<'a, K, V, P>
Source§fn from_indexical_iter(
iter: impl Iterator<Item = (U, V)>,
domain: &P::Pointer<IndexedDomain<K>>,
) -> Self
fn from_indexical_iter( iter: impl Iterator<Item = (U, V)>, domain: &P::Pointer<IndexedDomain<K>>, ) -> Self
Converts an iterator into a collection within the given domain.