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) -> &Vec<[u32; 8]>
pub fn bitset(&self) -> &Vec<[u32; 8]>
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<Vec<[u32; 8]>>,
) -> EntityIterator<'a> ⓘ
pub fn iter_with_bitset<'a>( &'a self, bitset: Rc<Vec<[u32; 8]>>, ) -> 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
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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more