pub struct Entities { /* private fields */ }
Expand description

Creates, destroys and recycles entities.

The most common reason to interact with Entities is to create or destroy an Entity.

let mut world = World::default();
let entities = world.resource_mut::<Entities>().unwrap();
let ent = entities.create();
entities.destroy(ent);

Implementations

Return an iterator over all alive entities.

Returns the number of entities that are currently alive.

Create many entities at once, returning a list of their ids.

An Entity can be made from its usize id using Entities::hydrate.

Create one entity and return it.

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.

Destroys all entities.

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.

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.

Hydrate an Entity from an id.

Returns None the entity with the given id does not exist, or has been destroyed.

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.

Hydrate the entity with the given id and then lazily add the given component.

This is a noop if the entity does not exist.

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

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.