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 enum
s).
Required Associated Types§
Sourcetype DenseValueSlots: Default
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§
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>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.