Struct spirt::EntityOrientedDenseMap
source · pub struct EntityOrientedDenseMap<K: EntityOrientedMapKey<V>, V> {
chunk_start_to_value_slots: SmallFxHashMap<K::Entity, Vec<K::DenseValueSlots>>,
}
Expand description
Map with K
keys and V
values, that is:
- “entity-oriented”
K
keys, i.e. that are or contain exactly one entity (supported viaK: EntityOrientedMapKey<V>
for extensibility) - “dense” in the sense of few (or no) gaps in (the entities in) its keys
(relative to the entities defined in the corresponding
EntityDefs
)
By design there is no way to iterate the entries in an EntityOrientedDenseMap
.
Fields§
§chunk_start_to_value_slots: SmallFxHashMap<K::Entity, Vec<K::DenseValueSlots>>
Like in EntityDefs
, entities are grouped into chunks, but there is no
flattening, since arbitrary insertion orders have to be supported.
Implementations§
source§impl<K: EntityOrientedMapKey<V>, V> EntityOrientedDenseMap<K, V>
impl<K: EntityOrientedMapKey<V>, V> EntityOrientedDenseMap<K, V>
pub fn new() -> Self
pub fn entry(&mut self, key: K) -> &mut Option<V>
pub fn insert(&mut self, key: K, value: V) -> Option<V>
pub fn get(&self, key: K) -> Option<&V>
pub fn get_mut(&mut self, key: K) -> Option<&mut V>
pub fn remove(&mut self, key: K) -> Option<V>
fn get_slot_mut(&mut self, key: K) -> Option<&mut Option<V>>
Trait Implementations§
source§impl<K: Clone + EntityOrientedMapKey<V>, V: Clone> Clone for EntityOrientedDenseMap<K, V>
impl<K: Clone + EntityOrientedMapKey<V>, V: Clone> Clone for EntityOrientedDenseMap<K, V>
source§fn clone(&self) -> EntityOrientedDenseMap<K, V>
fn clone(&self) -> EntityOrientedDenseMap<K, V>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<K: EntityOrientedMapKey<V>, V> Default for EntityOrientedDenseMap<K, V>
impl<K: EntityOrientedMapKey<V>, V> Default for EntityOrientedDenseMap<K, V>
source§impl<K: EntityOrientedMapKey<V>, V> Index<K> for EntityOrientedDenseMap<K, V>
impl<K: EntityOrientedMapKey<V>, V> Index<K> for EntityOrientedDenseMap<K, V>
source§impl<K: EntityOrientedMapKey<V>, V> IndexMut<K> for EntityOrientedDenseMap<K, V>
impl<K: EntityOrientedMapKey<V>, V> IndexMut<K> for EntityOrientedDenseMap<K, V>
Auto Trait Implementations§
impl<K, V> RefUnwindSafe for EntityOrientedDenseMap<K, V>where
<K as EntityOrientedMapKey<V>>::DenseValueSlots: RefUnwindSafe,
<K as EntityOrientedMapKey<V>>::Entity: RefUnwindSafe,
impl<K, V> Send for EntityOrientedDenseMap<K, V>where
<K as EntityOrientedMapKey<V>>::DenseValueSlots: Send,
<K as EntityOrientedMapKey<V>>::Entity: Send,
impl<K, V> Sync for EntityOrientedDenseMap<K, V>where
<K as EntityOrientedMapKey<V>>::DenseValueSlots: Sync,
<K as EntityOrientedMapKey<V>>::Entity: Sync,
impl<K, V> Unpin for EntityOrientedDenseMap<K, V>where
<K as EntityOrientedMapKey<V>>::DenseValueSlots: Unpin,
<K as EntityOrientedMapKey<V>>::Entity: Unpin,
impl<K, V> UnwindSafe for EntityOrientedDenseMap<K, V>where
<K as EntityOrientedMapKey<V>>::DenseValueSlots: UnwindSafe,
<K as EntityOrientedMapKey<V>>::Entity: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more