Struct cranelift::prelude::codegen::entity::EntityMap[]

pub struct EntityMap<K, V> where
    K: EntityRef,
    V: Clone
{ /* fields omitted */ }

A mapping K -> V for densely indexed entity references.

The EntityMap data structure uses the dense index space to implement a map with a vector. Unlike PrimaryMap, an EntityMap 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.

Methods

impl<K, V> EntityMap<K, V> where
    K: EntityRef,
    V: Clone

Shared EntityMap implementation for all value types.

Create a new empty map.

Create a new empty map with a specified default value.

This constructor does not require V to implement Default.

Get the element at k if it exists.

Is this map completely empty?

Remove all entries from this map.

Important traits for Iter<'a, K, V>

Iterate over all the keys and values in this map.

Important traits for IterMut<'a, K, V>

Iterate over all the keys and values in this map, mutable edition.

Important traits for Keys<K>

Iterate over all the keys in this map.

Important traits for Iter<'a, T>

Iterate over all the keys in this map.

Important traits for IterMut<'a, T>

Iterate over all the keys in this map, mutable edition.

Resize the map to have n entries by adding default entries as needed.

Trait Implementations

impl<K, V> IndexMut<K> for EntityMap<K, V> where
    K: EntityRef,
    V: Clone

Mutable indexing into an EntityMap.

The map grows as needed to accommodate new keys.

Important traits for &'a mut R

Performs the mutable indexing (container[index]) operation.

impl<K, V> Index<K> for EntityMap<K, V> where
    K: EntityRef,
    V: Clone

Immutable indexing into an EntityMap.

All keys are permitted. Untouched entries have the default value.

The returned type after indexing.

Important traits for &'a mut R

Performs the indexing (container[index]) operation.

impl<K, V> Clone for EntityMap<K, V> where
    K: Clone + EntityRef,
    V: Clone + Clone

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<K, V> Debug for EntityMap<K, V> where
    K: Debug + EntityRef,
    V: Debug + Clone

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<K, V> Send for EntityMap<K, V> where
    K: Send,
    V: Send

impl<K, V> Sync for EntityMap<K, V> where
    K: Sync,
    V: Sync