Expand description
The ECS prelude.
This includes the most common types in this crate, re-exported for your convenience.
Macros§
- children
- Returns a SpawnRelatedBundlethat will insert theChildrencomponent, spawn aSpawnableListof entities with given bundles that relate to theChildrenentity via theChildOfcomponent, and reserve space in theChildrenfor each spawned entity.
- related
- Returns a SpawnRelatedBundlethat will insert the givenRelationshipTarget, spawn aSpawnableListof entities with given bundles that relate to theRelationshipTargetentity via theRelationshipTarget::Relationshipcomponent, and reserve space in theRelationshipTargetfor each spawned entity.
Structs§
- Add
- Trigger emitted when a component is inserted onto an entity that does not already have that
component. Runs before Insert. SeeComponentHooks::on_addfor more information.
- Added
- A filter on a component that only retains results the first time after they have been added.
- Allow
- Allows a query to contain entities with the component T, bypassingDefaultQueryFilters.
- AnyOf
- The AnyOfquery parameter fetches entities with any of the component types included in T.
- AppTypeRegistry 
- A ResourcestoringTypeRegistryfor type registrations relevant to a whole app.
- ApplyDeferred 
- A special Systemthat instructs the executor to callSystem::apply_deferredon the systems that have run but not applied theirDeferredsystem parameters (likeCommands) or other system buffers.
- BevyError 
- The built in “universal” Bevy error type. This has a blanket Fromimpl for any type that implements Rust’sError, meaning it can be used as a “catch all” error.
- Changed
- A filter on a component that only retains results the first time after they have been added or mutably dereferenced.
- ChildOf
- Stores the parent entity of this child entity with this component.
- Children
- Tracks which entities are children of this parent entity.
- Commands
- A Commandqueue to perform structural changes to theWorld.
- Deferred
- A SystemParamthat stores a buffer which gets applied to theWorldduringApplyDeferred. This is used internally byCommandsto deferWorldmutations.
- Despawn
- EntityEventemitted for each component on an entity when it is despawned. See- ComponentHooks::on_despawnfor more information.
- Entity
- Lightweight identifier of an entity.
- EntityCommands 
- A list of commands that will be run to modify an Entity.
- EntityMut 
- Provides mutable access to a single entity and all of its components.
- EntityRef 
- A read-only reference to a particular Entityand all of its components.
- EntityWorld Mut 
- A mutable reference to a particular Entity, and the entire world.
- FilteredResources 
- Provides read-only access to a set of Resources defined by the containedAccess.
- FilteredResources Mut 
- Provides mutable access to a set of Resources defined by the containedAccess.
- Has
- Returns a bool that describes if an entity has the component T.
- If
- A SystemParamthat wraps another parameter and causes its system to skip instead of failing when the parameter is invalid.
- In
- A SystemInputtype which denotes that aSystemreceives an input value of typeTfrom its caller.
- InMut
- A SystemInputtype which denotes that aSystemreceives a mutable reference to a value of typeTfrom its caller.
- InRef
- A SystemInputtype which denotes that aSystemreceives a read-only reference to a value of typeTfrom its caller.
- Insert
- Trigger emitted when a component is inserted, regardless of whether or not the entity already
had that component. Runs after Add, if it ran. SeeComponentHooks::on_insertfor more information.
- Local
- A system local SystemParam.
- MessageMutator 
- Mutably reads messages of type Tkeeping track of which messages have already been read by each system allowing multiple systems to read the same messages. Ideal for chains of systems that all want to modify the same messages.
- MessageReader 
- Reads Messages of typeTin order and tracks which messages have already been read.
- MessageWriter 
- Writes Messages of typeT.
- Messages
- A message collection that represents the messages that occurred within the last two
Messages::updatecalls. Messages can be written to using aMessageWriterand are typically cheaply read using aMessageReader.
- Mut
- Unique mutable borrow of an entity’s component or of a resource.
- Name
- Component used to identify an entity. Stores a hash for faster comparisons.
- NameOrEntity 
- Convenient query for giving a human friendly name to an entity.
- NonSend
- Shared borrow of a non-Sendresource.
- NonSendMut 
- Unique borrow of a non-Sendresource.
- Observer
- An Observersystem. Add thisComponentto anEntityto turn it into an “observer”.
- On
- A system parameter used by an observer to process events. See ObserverandEventfor examples.
- Or
- A filter that tests if any of the given filters apply.
- ParallelCommands 
- An alternative to Commandsthat can be used in parallel contexts, such as those inQuery::par_iter.
- ParamSet 
- A collection of potentially conflicting SystemParams allowed by disjoint access.
- Populated
- System parameter that works very much like Queryexcept it always contains at least one matching entity.
- Query
- A system parameter that provides selective access to the Componentdata stored in aWorld.
- QueryBuilder 
- Builder struct to create QueryStateinstances at runtime.
- QueryState 
- Provides scoped access to a Worldstate according to a givenQueryDataandQueryFilter.
- Ref
- Shared borrow of an entity’s component with access to change detection.
Similar to Mutbut is immutable and so doesn’t require unique access.
- ReflectComponent 
- A struct used to operate on reflected Componenttrait of a type.
- ReflectFrom World 
- A struct used to operate on the reflected FromWorldtrait of a type.
- ReflectResource 
- A struct used to operate on reflected Resourceof a type.
- Remove
- Trigger emitted when a component is removed from an entity, and runs before the component is
removed, so you can still access the component data.
See ComponentHooks::on_removefor more information.
- RemovedComponents 
- A SystemParamthat yields entities that had theirTComponentremoved or have been despawned with it.
- Replace
- Trigger emitted when a component is removed from an entity, regardless of whether or not it is later replaced.
- Res
- Shared borrow of a Resource.
- ResMut
- Unique mutable borrow of a Resource.
- Schedule
- A collection of systems, and the metadata and executor needed to run them in a certain order under certain conditions.
- Schedules
- Resource that stores Schedules mapped toScheduleLabels excluding the current runningSchedule.
- Single
- System parameter that provides access to single entity’s components, much like Query::single/Query::single_mut.
- Spawn
- A wrapper over a Bundleindicating that an entity should be spawned with thatBundle. This is intended to be used for hierarchical spawning via traits likeSpawnableListandSpawnRelated.
- SpawnIter 
- A SpawnableListthat spawns entities using an iterator of a givenBundle:
- SpawnWith 
- A SpawnableListthat spawns entities using aFnOncewith aRelatedSpawneras an argument:
- With
- Filter that selects entities with a component T.
- WithOneRelated 
- A wrapper over an Entityindicating that an entity should be added. This is intended to be used for hierarchical spawning via traits likeSpawnableListandSpawnRelated.
- WithRelated 
- A SpawnableListthat links already spawned entities to the root entity via relations of typeI.
- Without
- Filter that selects entities without a component T.
- World
- Stores and exposes operations on entities, components, resources, and their associated metadata.
Traits§
- Bundle
- The Bundletrait enables insertion and removal ofComponents from an entity.
- Command
- A Worldmutation.
- Component
- A data type that can be used to store data for an entity.
- ContainsEntity 
- A trait for types that contain an Entity.
- DetectChanges 
- Types that can read change detection information.
This change detection is controlled by DetectChangesMuttypes such asResMut.
- DetectChanges Mut 
- Types that implement reliable change detection.
- EntityCommand 
- A command which gets executed for a given Entity.
- EntityEvent 
- An EntityEventis anEventthat is triggered for a specificEntityEvent::event_targetentity:
- EntityMapper 
- An implementor of this trait knows how to map an Entityinto anotherEntity.
- Event
- An Eventis something that “happens” at a given moment.
- FromWorld 
- Creates an instance of the type this trait is implemented for
using data from the supplied World.
- IntoSchedule Configs 
- Types that can convert into a ScheduleConfigs.
- IntoSystem 
- Conversion trait to turn something into a System.
- IntoSystem Set 
- Types that can be converted into a SystemSet.
- Message
- A buffered message for pull-based event handling.
- ReadOnly System 
- Systemtypes that do not modify the- Worldwhen run. This is implemented for any systems whose parameters all implement- ReadOnlySystemParam.
- RelationshipTarget 
- A Componentcontaining the collection of entities that relate to thisEntityvia the associatedRelationshiptype. See theRelationshipdocumentation for more information.
- Resource
- A type that can be inserted into a Worldas a singleton.
- SpawnRelated 
- RelationshipTargetmethods that create a- Bundlewith a- DynamicBundle::Effectthat:
- System
- An ECS system that can be added to a Schedule
- SystemCondition 
- A system that determines if one or more scheduled systems should run.
- SystemInput 
- Trait for types that can be used as input to Systems.
- SystemParam Builder 
- A builder that can create a SystemParam.
- SystemParam Function 
- A trait implemented for all functions that can be used as Systems.
- SystemSet 
- System sets are tag-like labels that can be used to group systems together.
Functions§
- any_component_ removed 
- A SystemCondition-satisfying system that returnstrueif there are any entity with a component of the given type removed.
- any_match_ filter 
- A SystemCondition-satisfying system that returnstrueif there are any entities that match the givenQueryFilter.
- any_with_ component 
- A SystemCondition-satisfying system that returnstrueif there are any entities with the given component type.
- condition_changed 
- Generates a SystemConditionthat returns true when the passed one changes.
- condition_changed_ to 
- Generates a SystemConditionthat returns true when the result of the passed one went from false to true since the last time this was called.
- not
- Generates a SystemConditionthat inverses the result of passed one.
- on_event Deprecated 
- A SystemCondition-satisfying system that returnstrueif there are any new events of the given type since it was last called.
- on_message 
- A SystemCondition-satisfying system that returnstrueif there are any new messages of the given type since it was last called.
- resource_added 
- A SystemCondition-satisfying system that returnstrueif the resource of the given type has been added since the condition was last checked.
- resource_changed 
- A SystemCondition-satisfying system that returnstrueif the resource of the given type has been added or mutably dereferenced since the condition was last checked.
- resource_changed_ or_ removed 
- A SystemCondition-satisfying system that returnstrueif the resource of the given type has been added, removed or mutably dereferenced since the condition was last checked.
- resource_equals 
- Generates a SystemCondition-satisfying closure that returnstrueif the resource is equal tovalue.
- resource_exists 
- A SystemCondition-satisfying system that returnstrueif the resource exists.
- resource_exists_ and_ changed 
- A SystemCondition-satisfying system that returnstrueif the resource of the given type has been added or mutably dereferenced since the condition was last checked.
- resource_exists_ and_ equals 
- Generates a SystemCondition-satisfying closure that returnstrueif the resource exists and is equal tovalue.
- resource_removed 
- A SystemCondition-satisfying system that returnstrueif the resource of the given type has been removed since the condition was last checked.
- run_once 
- A SystemCondition-satisfying system that returnstrueon the first time the condition is run and false every time after.
Type Aliases§
- ChildSpawner 
- A type alias over RelatedSpawnerused to spawn child entities containing aChildOfrelationship.
- ChildSpawner Commands 
- A type alias over RelatedSpawnerCommandsused to spawn child entities containing aChildOfrelationship.
- EventReader Deprecated 
- This is deprecated. See MessageReader
- EventWriter Deprecated 
- This is deprecated. See MessageWriter
- EventsDeprecated 
- This is deprecated. See Messages
- OnAddDeprecated 
- Deprecated in favor of Add.
- OnDespawnDeprecated 
- Deprecated in favor of Despawn.
- OnInsertDeprecated 
- Deprecated in favor of Insert.
- OnRemoveDeprecated 
- Deprecated in favor of Remove.
- OnReplaceDeprecated 
- Deprecated in favor of Replace.
- Result
- A result type for use in fallible systems, commands and observers.
- SystemIn 
- Shorthand way to get the System::Infor aSystemas aSystemInput::Inner.
- TriggerDeprecated 
- Deprecated in favor of On.
Derive Macros§
- Bundle
- Implement the Bundletrait.
- Component
- Cheat sheet for derive syntax,
see full explanation and examples on the Componenttrait doc.
- EntityEvent 
- Cheat sheet for derive syntax,
see full explanation on EntityEventtrait docs.
- Event
- Implement the Eventtrait.
- FromWorld 
- Implement the FromWorldtrait.
- Message
- Implement the Messagetrait.
- Resource
- Implement the Resourcetrait.
- SystemSet 
- Derive macro generating an impl of the trait SystemSet.