Type Alias wasmtime_environ::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.
Trait Implementations§
source§impl<'de, K, V> Deserialize<'de> for SparseMap<K, V>where
K: EntityRef + Deserialize<'de>,
V: SparseMapValue<K> + Deserialize<'de>,
impl<'de, K, V> Deserialize<'de> for SparseMap<K, V>where K: EntityRef + Deserialize<'de>, V: SparseMapValue<K> + Deserialize<'de>,
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<SparseMap<K, V>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>( __deserializer: __D ) -> Result<SparseMap<K, V>, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<K, V> Serialize for SparseMap<K, V>where
K: EntityRef + Serialize,
V: SparseMapValue<K> + Serialize,
impl<K, V> Serialize for SparseMap<K, V>where K: EntityRef + Serialize, V: SparseMapValue<K> + Serialize,
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,
Serialize this value into the given Serde serializer. Read more