pub struct Entities { /* private fields */ }Expand description
Implementations
sourceimpl Entities
impl Entities
pub fn new(lazy_op_sender: Sender<LazyOp>) -> Self
sourcepub fn alive_iter(&self) -> impl Iterator<Item = Entity> + '_
pub fn alive_iter(&self) -> impl Iterator<Item = Entity> + '_
Return an iterator over all alive entities.
sourcepub fn create_many(&mut self, how_many: usize) -> Vec<usize>
pub fn create_many(&mut self, how_many: usize) -> Vec<usize>
Create many entities at once, returning a list of their ids.
An Entity can be made from its usize id using Entities::hydrate.
sourcepub fn destroy(&self, entity: Entity)
pub fn destroy(&self, entity: Entity)
Lazily destroy an entity, removing its components and recycling it at the end of this tick.
NOTE:
Destroyed entities will have their components removed
automatically during upkeep, which happens each World::tick_lazy.
sourcepub fn destroy_all(&mut self)
pub fn destroy_all(&mut self)
Destroys all entities.
sourcepub fn deleted_iter(&self) -> impl Iterator<Item = Entry<()>> + '_
pub fn deleted_iter(&self) -> impl Iterator<Item = Entry<()>> + '_
Produce an iterator of deleted entities as entries.
This iterator should be filtered at the callsite for the latest changed entries since a stored iteration timestamp.
sourcepub fn deleted_iter_of<T: 'static>(
&self
) -> impl Iterator<Item = Entry<()>> + '_
pub fn deleted_iter_of<T: 'static>(
&self
) -> impl Iterator<Item = Entry<()>> + '_
Produce an iterator of deleted entities that had a component of the given type, as entries.
This iterator should be filtered at the callsite for the latest changed entries since a stored iteration timestamp.
sourcepub fn hydrate(&self, entity_id: usize) -> Option<Entity>
pub fn hydrate(&self, entity_id: usize) -> Option<Entity>
Hydrate an Entity from an id.
Returns None the entity with the given id does not exist, or has
been destroyed.
sourcepub fn insert_bundle<B: IsBundle + Send + Sync + 'static>(
&self,
entity_id: usize,
bundle: B
)
pub fn insert_bundle<B: IsBundle + Send + Sync + 'static>(
&self,
entity_id: usize,
bundle: B
)
Hydrate the entity with the given id and then lazily add the given bundle to the entity.
This is a noop if the entity does not exist.
sourcepub fn insert_component<T: Send + Sync + 'static>(
&self,
entity_id: usize,
component: T
)
pub fn insert_component<T: Send + Sync + 'static>(
&self,
entity_id: usize,
component: T
)
Hydrate the entity with the given id and then lazily add the given component.
This is a noop if the entity does not exist.
sourcepub fn remove_component<T: Send + Sync + 'static>(&self, entity_id: usize)
pub fn remove_component<T: Send + Sync + 'static>(&self, entity_id: usize)
Hydrate the entity with the given id and then lazily remove the component of the given type.
This is a noop if the entity does not exist.