Module prelude

Source
Expand description

The ECS prelude.

This includes the most common types in this crate, re-exported for your convenience.

Structs§

Added
A filter on a component that only retains results the first time after they have been added.
AnyOf
The AnyOf query parameter fetches entities with any of the component types included in T.
AppTypeRegistry
A Resource storing TypeRegistry for type registrations relevant to a whole app.
Changed
A filter on a component that only retains results the first time after they have been added or mutably dereferenced.
Commands
A Command queue to perform structural changes to the World.
Deferred
A SystemParam that stores a buffer which gets applied to the World during apply_deferred. This is used internally by Commands to defer World mutations.
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 Entity and all of its components.
EntityWorldMut
A mutable reference to a particular Entity, and the entire world.
EventMutator
Mutably reads events of type T keeping track of which events have already been read by each system allowing multiple systems to read the same events. Ideal for chains of systems that all want to modify the same events.
EventReader
Reads events of type T in order and tracks which events have already been read.
EventWriter
Sends events of type T.
Events
An event collection that represents the events that occurred within the last two Events::update calls. Events can be written to using an EventWriter and are typically cheaply read using an EventReader.
FilteredResources
Provides read-only access to a set of Resources defined by the contained Access.
FilteredResourcesMut
Provides mutable access to a set of Resources defined by the contained Access.
Has
Returns a bool that describes if an entity has the component T.
In
A SystemInput type which denotes that a System receives an input value of type T from its caller.
InMut
A SystemInput type which denotes that a System receives a mutable reference to a value of type T from its caller.
InRef
A SystemInput type which denotes that a System receives a read-only reference to a value of type T from its caller.
Local
A system local SystemParam.
Mut
Unique mutable borrow of an entity’s component or of a resource.
NonSend
Shared borrow of a non-Send resource.
NonSendMut
Unique borrow of a non-Send resource.
Observer
An Observer system. Add this Component to an Entity to turn it into an “observer”.
OnAdd
Trigger emitted when a component is added to an entity. See crate::component::ComponentHooks::on_add for more information.
OnInsert
Trigger emitted when a component is inserted onto an entity. See crate::component::ComponentHooks::on_insert for more information.
OnRemove
Trigger emitted when a component is removed from an entity. See crate::component::ComponentHooks::on_remove for more information.
OnReplace
Trigger emitted when a component is replaced on an entity. See crate::component::ComponentHooks::on_replace for more information.
Or
A filter that tests if any of the given filters apply.
ParallelCommands
An alternative to Commands that can be used in parallel contexts, such as those in Query::par_iter.
ParamSet
A collection of potentially conflicting SystemParams allowed by disjoint access.
Populated
System parameter that works very much like Query except it always contains at least one matching entity.
Query
System parameter that provides selective access to the Component data stored in a World.
QueryBuilder
Builder struct to create QueryState instances at runtime.
QueryState
Provides scoped access to a World state according to a given QueryData and QueryFilter.
Ref
Shared borrow of an entity’s component with access to change detection. Similar to Mut but is immutable and so doesn’t require unique access.
ReflectComponent
A struct used to operate on reflected Component trait of a type.
ReflectFromWorld
A struct used to operate on the reflected FromWorld trait of a type.
ReflectResource
A struct used to operate on reflected Resource of a type.
RemovedComponents
A SystemParam that yields entities that had their T Component removed or have been despawned with it.
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 to ScheduleLabels excluding the current running Schedule.
Single
System parameter that provides access to single entity’s components, much like Query::single/Query::single_mut.
Trigger
Type containing triggered Event information for a given run of an Observer. This contains the Event data itself. If it was triggered for a specific Entity, it includes that as well. It also contains event propagation information. See Trigger::propagate for more information.
With
Filter that selects entities with a component T.
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 Bundle trait enables insertion and removal of Components from an entity.
Command
A World mutation.
Component
A data type that can be used to store data for an entity.
Condition
A system that determines if one or more scheduled systems should run.
DetectChanges
Types that can read change detection information. This change detection is controlled by DetectChangesMut types such as ResMut.
DetectChangesMut
Types that implement reliable change detection.
EntityCommand
A Command which gets executed for a given Entity.
EntityMapper
An implementor of this trait knows how to map an Entity into another Entity.
Event
Something that “happens” and might be read / observed by app logic.
FromWorld
Creates an instance of the type this trait is implemented for using data from the supplied World.
IntoSystem
Conversion trait to turn something into a System.
IntoSystemConfigs
Types that can convert into a SystemConfigs.
IntoSystemSet
Types that can be converted into a SystemSet.
IntoSystemSetConfigs
Types that can convert into a SystemSetConfigs.
ReadOnlySystem
System types that do not modify the World when run. This is implemented for any systems whose parameters all implement ReadOnlySystemParam.
Resource
A type that can be inserted into a World as a singleton.
System
An ECS system that can be added to a Schedule
SystemInput
Trait for types that can be used as input to Systems.
SystemParamBuilder
A builder that can create a SystemParam.
SystemParamFunction
A trait implemented for all functions that can be used as Systems.
SystemSet
Types that identify logical groups of systems.

Functions§

any_component_removed
A Condition-satisfying system that returns true if there are any entity with a component of the given type removed.
any_with_component
A Condition-satisfying system that returns true if there are any entities with the given component type.
apply_deferred
Instructs the executor to call System::apply_deferred on the systems that have run but not applied their Deferred system parameters (like Commands) or other system buffers.
condition_changed
Generates a Condition that returns true when the passed one changes.
condition_changed_to
Generates a Condition that returns true when the result of the passed one went from false to true since the last time this was called.
not
Generates a Condition that inverses the result of passed one.
on_event
A Condition-satisfying system that returns true if there are any new events of the given type since it was last called.
resource_added
A Condition-satisfying system that returns true if the resource of the given type has been added since the condition was last checked.
resource_changed
A Condition-satisfying system that returns true if the resource of the given type has had its value changed since the condition was last checked.
resource_changed_or_removed
A Condition-satisfying system that returns true if the resource of the given type has had its value changed since the condition was last checked.
resource_equals
Generates a Condition-satisfying closure that returns true if the resource is equal to value.
resource_exists
A Condition-satisfying system that returns true if the resource exists.
resource_exists_and_changed
A Condition-satisfying system that returns true if the resource of the given type has had its value changed since the condition was last checked.
resource_exists_and_equals
Generates a Condition-satisfying closure that returns true if the resource exists and is equal to value.
resource_removed
A Condition-satisfying system that returns true if the resource of the given type has been removed since the condition was last checked.
run_once
A Condition-satisfying system that returns true on the first time the condition is run and false every time after.

Type Aliases§

SystemIn
Shorthand way to get the System::In for a System as a SystemInput::Inner.

Derive Macros§

Bundle
Component
Event
Resource
SystemSet
Derive macro generating an impl of the trait SystemSet.