Type Alias cranelift_entity::SparseSet
source · pub type SparseSet<T> = SparseMap<T, T>;
Expand description
A sparse set of entity references.
Any type that implements EntityRef
can be used as a sparse set value too.
Aliased Type§
struct SparseSet<T> { /* private fields */ }
Implementations§
source§impl<K, V> SparseMap<K, V>where
K: EntityRef,
V: SparseMapValue<K>,
impl<K, V> SparseMap<K, V>where K: EntityRef, V: SparseMapValue<K>,
sourcepub fn get(&self, key: K) -> Option<&V>
pub fn get(&self, key: K) -> Option<&V>
Returns a reference to the value corresponding to the key.
sourcepub fn get_mut(&mut self, key: K) -> Option<&mut V>
pub fn get_mut(&mut self, key: K) -> Option<&mut V>
Returns a mutable reference to the value corresponding to the key.
Note that the returned value must not be mutated in a way that would change its key. This would invalidate the sparse set data structure.
sourcepub fn contains_key(&self, key: K) -> bool
pub fn contains_key(&self, key: K) -> bool
Return true
if the map contains a value corresponding to key
.
sourcepub fn insert(&mut self, value: V) -> Option<V>
pub fn insert(&mut self, value: V) -> Option<V>
Insert a value into the map.
If the map did not have this key present, None
is returned.
If the map did have this key present, the value is updated, and the old value is returned.
It is not necessary to provide a key since the value knows its own key already.