Struct bevy::ecs::storage::ComponentSparseSet
source · pub struct ComponentSparseSet { /* private fields */ }
Expand description
A sparse data structure of Component
s.
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<'_>)>
pub fn get_with_ticks(&self, entity: Entity) -> Option<(Ptr<'_>, TickCells<'_>)>
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.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ComponentSparseSet
impl !Send for ComponentSparseSet
impl !Sync for ComponentSparseSet
impl Unpin for ComponentSparseSet
impl UnwindSafe for ComponentSparseSet
Blanket Implementations§
source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
T
ShaderType
for self
. When used in AsBindGroup
derives, it is safe to assume that all images in self
exist.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
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.