pub struct Entities { /* private fields */ }Expand description
Creates and destroys entities.
Exists in World by default.
Implementations
sourceimpl Entities
impl Entities
pub fn new(lazy_op_sender: Sender<LazyOp>) -> Self
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, 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 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 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.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Entities
impl Send for Entities
impl Sync for Entities
impl Unpin for Entities
impl UnwindSafe for Entities
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more