Struct wasmer_types::entity::SecondaryMap
source · [−]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
sourceimpl<K, V> SecondaryMap<K, V> where
K: EntityRef,
V: Clone,
impl<K, V> SecondaryMap<K, V> where
K: EntityRef,
V: Clone,
Shared SecondaryMap
implementation for all value types.
sourcepub fn with_capacity(capacity: usize) -> Self where
V: Default,
pub fn with_capacity(capacity: usize) -> Self 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) -> Self
pub fn with_default(default: V) -> Self
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(&self) -> Iter<'_, K, V>ⓘNotable traits for Iter<'a, K, V>impl<'a, K: EntityRef, V> Iterator for Iter<'a, K, V> type Item = (K, &'a V);
pub fn iter(&self) -> Iter<'_, K, V>ⓘNotable traits for Iter<'a, K, V>impl<'a, K: EntityRef, V> Iterator for Iter<'a, K, V> type Item = (K, &'a V);
Iterate over all the keys and values in this map.
sourcepub fn iter_mut(&mut self) -> IterMut<'_, K, V>ⓘNotable traits for IterMut<'a, K, V>impl<'a, K: EntityRef, V> Iterator for IterMut<'a, K, V> type Item = (K, &'a mut V);
pub fn iter_mut(&mut self) -> IterMut<'_, K, V>ⓘNotable traits for IterMut<'a, K, V>impl<'a, K: EntityRef, V> Iterator for IterMut<'a, K, V> type Item = (K, &'a mut V);
Iterate over all the keys and values in this map, mutable edition.
sourcepub fn keys(&self) -> Keys<K>ⓘNotable traits for Keys<K>impl<K: EntityRef> Iterator for Keys<K> type Item = K;
pub fn keys(&self) -> Keys<K>ⓘNotable traits for Keys<K>impl<K: EntityRef> Iterator for Keys<K> type Item = K;
Iterate over all the keys in this map.
sourcepub fn values(&self) -> Iter<'_, V>ⓘNotable traits for Iter<'a, T>impl<'a, T> Iterator for Iter<'a, T> type Item = &'a T;
pub fn values(&self) -> Iter<'_, V>ⓘNotable traits for Iter<'a, T>impl<'a, T> Iterator for Iter<'a, T> type Item = &'a T;
Iterate over all the values in this map.
Trait Implementations
sourceimpl<K, V> Archive for SecondaryMap<K, V> where
K: EntityRef,
V: Clone,
Vec<V>: Archive,
V: Archive,
PhantomData<K>: Archive,
impl<K, V> Archive for SecondaryMap<K, V> where
K: EntityRef,
V: Clone,
Vec<V>: Archive,
V: Archive,
PhantomData<K>: Archive,
sourceimpl<K: Clone, V: Clone> Clone for SecondaryMap<K, V> where
K: EntityRef,
V: Clone,
impl<K: Clone, V: Clone> Clone for SecondaryMap<K, V> where
K: EntityRef,
V: Clone,
sourcefn clone(&self) -> SecondaryMap<K, V>
fn clone(&self) -> SecondaryMap<K, V>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<'de, K, V> Deserialize<'de> for SecondaryMap<K, V> where
K: EntityRef,
V: Clone + Deserialize<'de>,
impl<'de, K, V> Deserialize<'de> for SecondaryMap<K, V> where
K: EntityRef,
V: Clone + Deserialize<'de>,
sourcefn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<__D: Fallible + ?Sized, K, V> Deserialize<SecondaryMap<K, V>, __D> for Archived<SecondaryMap<K, V>> where
K: EntityRef,
V: Clone,
Vec<V>: Archive,
Archived<Vec<V>>: Deserialize<Vec<V>, __D>,
V: Archive,
Archived<V>: Deserialize<V, __D>,
PhantomData<K>: Archive,
Archived<PhantomData<K>>: Deserialize<PhantomData<K>, __D>,
impl<__D: Fallible + ?Sized, K, V> Deserialize<SecondaryMap<K, V>, __D> for Archived<SecondaryMap<K, V>> where
K: EntityRef,
V: Clone,
Vec<V>: Archive,
Archived<Vec<V>>: Deserialize<Vec<V>, __D>,
V: Archive,
Archived<V>: Deserialize<V, __D>,
PhantomData<K>: Archive,
Archived<PhantomData<K>>: Deserialize<PhantomData<K>, __D>,
sourcefn deserialize(
&self,
deserializer: &mut __D
) -> Result<SecondaryMap<K, V>, __D::Error>
fn deserialize(
&self,
deserializer: &mut __D
) -> Result<SecondaryMap<K, V>, __D::Error>
Deserializes using the given deserializer
sourceimpl<K, V> Index<K> for SecondaryMap<K, V> where
K: EntityRef,
V: Clone,
impl<K, V> Index<K> for SecondaryMap<K, V> where
K: EntityRef,
V: Clone,
Immutable indexing into an SecondaryMap
.
All keys are permitted. Untouched entries have the default value.
sourceimpl<K, V> IndexMut<K> for SecondaryMap<K, V> where
K: EntityRef,
V: Clone,
impl<K, V> IndexMut<K> for SecondaryMap<K, V> where
K: EntityRef,
V: Clone,
Mutable indexing into an SecondaryMap
.
The map grows as needed to accommodate new keys.
sourceimpl<K, V> MemoryUsage for SecondaryMap<K, V> where
K: EntityRef,
V: Clone + MemoryUsage,
impl<K, V> MemoryUsage for SecondaryMap<K, V> where
K: EntityRef,
V: Clone + MemoryUsage,
sourcefn size_of_val(&self, tracker: &mut dyn MemoryUsageTracker) -> usize
fn size_of_val(&self, tracker: &mut dyn MemoryUsageTracker) -> usize
Returns the size of the referenced value in bytes. Read more
sourceimpl<K, V> PartialEq<SecondaryMap<K, V>> for SecondaryMap<K, V> where
K: EntityRef,
V: Clone + PartialEq,
impl<K, V> PartialEq<SecondaryMap<K, V>> for SecondaryMap<K, V> where
K: EntityRef,
V: Clone + PartialEq,
sourceimpl<K, V> Serialize for SecondaryMap<K, V> where
K: EntityRef,
V: Clone + PartialEq + Serialize,
impl<K, V> Serialize for SecondaryMap<K, V> where
K: EntityRef,
V: Clone + PartialEq + Serialize,
sourceimpl<__S: Fallible + ?Sized, K, V> Serialize<__S> for SecondaryMap<K, V> where
K: EntityRef,
V: Clone,
Vec<V>: Serialize<__S>,
V: Serialize<__S>,
PhantomData<K>: Serialize<__S>,
impl<__S: Fallible + ?Sized, K, V> Serialize<__S> for SecondaryMap<K, V> where
K: EntityRef,
V: Clone,
Vec<V>: Serialize<__S>,
V: Serialize<__S>,
PhantomData<K>: Serialize<__S>,
impl<K, V> Eq for SecondaryMap<K, V> where
K: EntityRef,
V: Clone + PartialEq + Eq,
Auto Trait Implementations
impl<K, V> RefUnwindSafe for SecondaryMap<K, V> where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for SecondaryMap<K, V> where
K: Send,
V: Send,
impl<K, V> Sync for SecondaryMap<K, V> where
K: Sync,
V: Sync,
impl<K, V> Unpin for SecondaryMap<K, V> where
K: Unpin,
V: Unpin,
impl<K, V> UnwindSafe for SecondaryMap<K, V> where
K: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
sourceimpl<T> ArchivePointee for T
impl<T> ArchivePointee for T
type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
sourcefn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
sourceimpl<T> ArchiveUnsized for T where
T: Archive,
impl<T> ArchiveUnsized for T where
T: Archive,
type Archived = <T as Archive>::Archived
type Archived = <T as Archive>::Archived
The archived counterpart of this type. Unlike Archive
, it may be unsized. Read more
type MetadataResolver = ()
type MetadataResolver = ()
The resolver for the metadata of this type. Read more
sourceunsafe fn resolve_metadata(
&self,
usize,
<T as ArchiveUnsized>::MetadataResolver,
*mut <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata
)
unsafe fn resolve_metadata(
&self,
usize,
<T as ArchiveUnsized>::MetadataResolver,
*mut <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata
)
Creates the archived version of the metadata for this value at the given position and writes it to the given output. Read more
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<F, W, T, D> Deserialize<With<T, W>, D> for F where
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
impl<F, W, T, D> Deserialize<With<T, W>, D> for F where
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.