Module entity

Source
Expand description

Entity handling types.

An entity exclusively owns zero or more component instances, all of different types, and can dynamically acquire or lose them over its lifetime.

empty entity: Entity with zero components. pending entity: Entity reserved, but not flushed yet (see Entities::flush docs for reference). reserved entity: same as pending entity. invalid entity: pending entity flushed with invalid (see Entities::flush_as_invalid docs for reference).

See Entity to learn more.

§Usage

Operations involving entities and their components are performed either from a system by submitting commands, or from the outside (or from an exclusive system) by directly using World methods:

OperationCommandMethod
Spawn an entity with componentsCommands::spawnWorld::spawn
Spawn an entity without componentsCommands::spawn_emptyWorld::spawn_empty
Despawn an entityEntityCommands::despawnWorld::despawn
Insert a component, bundle, or tuple of components and bundles to an entityEntityCommands::insertEntityWorldMut::insert
Remove a component, bundle, or tuple of components and bundles from an entityEntityCommands::removeEntityWorldMut::remove

Structs§

Entities
A World’s internal metadata store on all of its entities.
Entity
Lightweight identifier of an entity.
EntityHash
A BuildHasher that results in a EntityHasher.
EntityHasher
A very fast hash that is only designed to work on generational indices like Entity. It will panic if attempting to hash a type containing non-u64 fields.
EntityLocation
A location of an entity in an archetype.
ReserveEntitiesIterator
An Iterator returning a sequence of Entity values from
SceneEntityMapper
A wrapper for EntityHashMap<Entity>, augmenting it with the ability to allocate new Entity references in a destination world. These newly allocated references are guaranteed to never point to any living entity in that world.

Traits§

EntityMapper
An implementor of this trait knows how to map an Entity into another Entity.
MapEntities
Operation to map all contained Entity fields in a type to new values.
VisitEntities
Apply an operation to all entities in a container.
VisitEntitiesMut
Apply an operation to mutable references to all entities in a container.

Type Aliases§

EntityHashMap
A HashMap pre-configured to use EntityHash hashing.
EntityHashSet
A HashSet pre-configured to use EntityHash hashing.

Derive Macros§

VisitEntities
VisitEntitiesMut