pub struct ComponentSparseSet { /* private fields */ }Expand description
A sparse data structure of Components.
Designed for relatively fast insertions and deletions.
Implementations§
Source§impl ComponentSparseSet
impl ComponentSparseSet
Sourcepub fn contains(&self, entity: Entity) -> bool
pub fn contains(&self, entity: Entity) -> bool
Returns true if the sparse set has a component value for the provided entity.
Sourcepub fn get(&self, entity: Entity) -> Option<Ptr<'_>>
pub fn get(&self, entity: Entity) -> Option<Ptr<'_>>
Returns a reference to the entity’s component value.
Returns None if entity does not have a component in the sparse set.
Sourcepub fn get_with_ticks(
&self,
entity: Entity,
) -> Option<(Ptr<'_>, TickCells<'_>, MaybeLocation<&UnsafeCell<&'static Location<'static>>>)>
pub fn get_with_ticks( &self, entity: Entity, ) -> Option<(Ptr<'_>, TickCells<'_>, MaybeLocation<&UnsafeCell<&'static Location<'static>>>)>
Returns references to the entity’s component value and its added and changed ticks.
Returns None if entity does not have a component in the sparse set.
Sourcepub fn get_added_tick(&self, entity: Entity) -> Option<&UnsafeCell<Tick>>
pub fn get_added_tick(&self, entity: Entity) -> Option<&UnsafeCell<Tick>>
Returns a reference to the “added” tick of the entity’s component value.
Returns None if entity does not have a component in the sparse set.
Sourcepub fn get_changed_tick(&self, entity: Entity) -> Option<&UnsafeCell<Tick>>
pub fn get_changed_tick(&self, entity: Entity) -> Option<&UnsafeCell<Tick>>
Returns a reference to the “changed” tick of the entity’s component value.
Returns None if entity does not have a component in the sparse set.
Sourcepub fn get_ticks(&self, entity: Entity) -> Option<ComponentTicks>
pub fn get_ticks(&self, entity: Entity) -> Option<ComponentTicks>
Returns a reference to the “added” and “changed” ticks of the entity’s component value.
Returns None if entity does not have a component in the sparse set.
Sourcepub fn get_changed_by(
&self,
entity: Entity,
) -> MaybeLocation<Option<&UnsafeCell<&'static Location<'static>>>>
pub fn get_changed_by( &self, entity: Entity, ) -> MaybeLocation<Option<&UnsafeCell<&'static Location<'static>>>>
Returns a reference to the calling location that last changed the entity’s component value.
Returns None if entity does not have a component in the sparse set.