pub trait EntityOrientedMapKey<V>: Copy {
    type Entity: Entity;
    type DenseValueSlots: Default;

    // Required methods
    fn to_entity(key: Self) -> Self::Entity;
    fn get_dense_value_slot(
        key: Self,
        slots: &Self::DenseValueSlots
    ) -> &Option<V>;
    fn get_dense_value_slot_mut(
        key: Self,
        slots: &mut Self::DenseValueSlots
    ) -> &mut Option<V>;
}
Expand description

EntityOriented*Map<Self, V> support trait, implemented for entity types, but which can also be implemented by users for their own newtypes and other types wrapping entity types (such as finite enums).

Required Associated Types§

source

type Entity: Entity

The entity type that appears exactly once in every value of Self.

source

type DenseValueSlots: Default

A type holding enough different Option<V> slots, for all possible values of Self, for a given Self::Entity value contained inside.

Required Methods§

source

fn to_entity(key: Self) -> Self::Entity

source

fn get_dense_value_slot(key: Self, slots: &Self::DenseValueSlots) -> &Option<V>

source

fn get_dense_value_slot_mut( key: Self, slots: &mut Self::DenseValueSlots ) -> &mut Option<V>

Implementors§

source§

impl<E: Entity, V> EntityOrientedMapKey<V> for E