Struct wasmtime_environ::SecondaryMap
source · pub struct SecondaryMap<K, V>{ /* private fields */ }
Expand description
A mapping K -> V
for densely indexed entity references.
The SecondaryMap
data structure uses the dense index space to implement a map with a vector.
Unlike PrimaryMap
, an SecondaryMap
can’t be used to allocate entity references. It is used
to associate secondary information with entities.
The map does not track if an entry for a key has been inserted or not. Instead it behaves as if all keys have a default entry from the beginning.
Implementations§
source§impl<K, V> SecondaryMap<K, V>
impl<K, V> SecondaryMap<K, V>
Shared SecondaryMap
implementation for all value types.
sourcepub fn new() -> SecondaryMap<K, V>where
V: Default,
pub fn new() -> SecondaryMap<K, V>where
V: Default,
Create a new empty map.
sourcepub fn with_capacity(capacity: usize) -> SecondaryMap<K, V>where
V: Default,
pub fn with_capacity(capacity: usize) -> SecondaryMap<K, V>where
V: Default,
Create a new, empty map with the specified capacity.
The map will be able to hold exactly capacity
elements without reallocating.
sourcepub fn with_default(default: V) -> SecondaryMap<K, V>
pub fn with_default(default: V) -> SecondaryMap<K, V>
Create a new empty map with a specified default value.
This constructor does not require V to implement Default.
sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Returns the number of elements the map can hold without reallocating.
sourcepub fn iter_mut(&mut self) -> IterMut<'_, K, V> ⓘ
pub fn iter_mut(&mut self) -> IterMut<'_, K, V> ⓘ
Iterate over all the keys and values in this map, mutable edition.
sourcepub fn values_mut(&mut self) -> IterMut<'_, V> ⓘ
pub fn values_mut(&mut self) -> IterMut<'_, V> ⓘ
Iterate over all the values in this map, mutable edition.
Trait Implementations§
source§impl<K, V> Clone for SecondaryMap<K, V>
impl<K, V> Clone for SecondaryMap<K, V>
source§fn clone(&self) -> SecondaryMap<K, V>
fn clone(&self) -> SecondaryMap<K, V>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<K, V> Debug for SecondaryMap<K, V>
impl<K, V> Debug for SecondaryMap<K, V>
source§impl<K, V> Default for SecondaryMap<K, V>
impl<K, V> Default for SecondaryMap<K, V>
source§fn default() -> SecondaryMap<K, V>
fn default() -> SecondaryMap<K, V>
source§impl<'de, K, V> Deserialize<'de> for SecondaryMap<K, V>
impl<'de, K, V> Deserialize<'de> for SecondaryMap<K, V>
source§fn deserialize<D>(
deserializer: D,
) -> Result<SecondaryMap<K, V>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<SecondaryMap<K, V>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
source§impl<K, V> Hash for SecondaryMap<K, V>
impl<K, V> Hash for SecondaryMap<K, V>
source§impl<K, V> Index<K> for SecondaryMap<K, V>
impl<K, V> Index<K> for SecondaryMap<K, V>
Immutable indexing into an SecondaryMap
.
All keys are permitted. Untouched entries have the default value.
source§impl<K, V> IndexMut<K> for SecondaryMap<K, V>
impl<K, V> IndexMut<K> for SecondaryMap<K, V>
Mutable indexing into an SecondaryMap
.
The map grows as needed to accommodate new keys.
source§impl<K, V> PartialEq for SecondaryMap<K, V>
impl<K, V> PartialEq for SecondaryMap<K, V>
source§fn eq(&self, other: &SecondaryMap<K, V>) -> bool
fn eq(&self, other: &SecondaryMap<K, V>) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl<K, V> Serialize for SecondaryMap<K, V>
impl<K, V> Serialize for SecondaryMap<K, V>
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,
impl<K, V> Eq for SecondaryMap<K, V>
Auto Trait Implementations§
impl<K, V> Freeze for SecondaryMap<K, V>where
V: Freeze,
impl<K, V> RefUnwindSafe for SecondaryMap<K, V>where
V: RefUnwindSafe,
K: RefUnwindSafe,
impl<K, V> Send for SecondaryMap<K, V>
impl<K, V> Sync for SecondaryMap<K, V>
impl<K, V> Unpin for SecondaryMap<K, V>
impl<K, V> UnwindSafe for SecondaryMap<K, V>where
V: UnwindSafe,
K: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.