Struct cretonne_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.

[src]

Create a new empty map.

[src]

Create a new empty map with a specified default value.

This constructor does not require V to implement Default.

[src]

Get the element at k if it exists.

[src]

Is this map completely empty?

[src]

Remove all entries from this map.

Important traits for Iter<'a, K, V>
[src]

Iterate over all the keys and values in this map.

Important traits for IterMut<'a, K, V>
[src]

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

Important traits for Keys<K>
[src]

Iterate over all the keys in this map.

[src]

Iterate over all the keys in this map.

[src]

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

[src]

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]

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

[src]

Returns a copy of the value. Read more

1.0.0
[src]

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.

[src]

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.

[src]

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