Struct cranelift_entity::EntityMap[][src]

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
[src]

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.

Iterate over all the keys in this map.

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: Debug, V: Debug> Debug for EntityMap<K, V> where
    K: EntityRef,
    V: Clone
[src]

Formats the value using the given formatter. Read more

impl<K: Clone, V: Clone> Clone for EntityMap<K, V> where
    K: EntityRef,
    V: Clone
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

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

Immutable indexing into an EntityMap.

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

The returned type after indexing.

Performs the indexing (container[index]) operation.

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

Mutable indexing into an EntityMap.

The map grows as needed to accommodate new keys.

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

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