pub struct Entities { /* private fields */ }
Expand description
Holds a list of alive entities. It also holds a list of entities that were recently killed, which allows to remove components of deleted entities at the end of a game frame.
Implementations§
Source§impl Entities
impl Entities
Sourcepub fn create(&mut self) -> Entity
pub fn create(&mut self) -> Entity
Creates a new Entity
and returns it.
This function will not reuse the index of an entity that is still in
the killed entities.
Sourcepub fn is_alive(&self, entity: Entity) -> bool
pub fn is_alive(&self, entity: Entity) -> bool
Checks if the Entity
is still alive.
Returns true if it is alive.
Returns false if it has been killed.
Sourcepub fn clear_killed(&mut self)
pub fn clear_killed(&mut self)
Clears the killed entity list.
Sourcepub fn bitset(&self) -> &BitSetVec
pub fn bitset(&self) -> &BitSetVec
Returns a bitset where each index where the bit is set to 1 indicates
the index of an alive entity.
Useful for joining over Entity
and Component<T>
at the same time.
Sourcepub fn iter_with_bitset<'a>(
&'a self,
bitset: Rc<BitSetVec>,
) -> EntityIterator<'a> ⓘ
pub fn iter_with_bitset<'a>( &'a self, bitset: Rc<BitSetVec>, ) -> EntityIterator<'a> ⓘ
Iterates over entities using the provided bitset.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Entities
impl RefUnwindSafe for Entities
impl Send for Entities
impl Sync for Entities
impl Unpin for Entities
impl UnwindSafe for Entities
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