Trait bevy::ecs::system::System

pub trait System: 'static + Send + Sync {
    type In;
    type Out;

Show 14 methods fn name(&self) -> Cow<'static, str>; fn component_access(&self) -> &Access<ComponentId>; fn archetype_component_access(&self) -> &Access<ArchetypeComponentId>; fn is_send(&self) -> bool; fn is_exclusive(&self) -> bool; unsafe fn run_unsafe(&mut self, input: Self::In, world: &World) -> Self::Out; fn apply_buffers(&mut self, world: &mut World); fn initialize(&mut self, _world: &mut World); fn update_archetype_component_access(&mut self, world: &World); fn check_change_tick(&mut self, change_tick: u32); fn get_last_change_tick(&self) -> u32; fn set_last_change_tick(&mut self, last_change_tick: u32); fn run(&mut self, input: Self::In, world: &mut World) -> Self::Out { ... } fn default_labels(&self) -> Vec<SystemLabelId, Global> { ... }
}
Expand description

An ECS system that can be added to a Schedule

Systems are functions with all arguments implementing SystemParam.

Systems are added to an application using App::add_system(my_system) or similar methods, and will generally run once per pass of the main loop.

Systems are executed in parallel, in opportunistic order; data access is managed automatically. It’s possible to specify explicit execution order between specific systems, see SystemDescriptor.

Required Associated Types§

The system’s input. See In for FunctionSystems.

The system’s output.

Required Methods§

Returns the system’s name.

Returns the system’s component Access.

Returns the system’s archetype component Access.

Returns true if the system is Send.

Returns true if the system must be run exclusively.

Runs the system with the given input in the world. Unlike System::run, this function takes a shared reference to World and may therefore break Rust’s aliasing rules, making it unsafe to call.

Safety

This might access world and resources in an unsafe manner. This should only be called in one of the following contexts: 1. This system is the only system running on the given world across all threads. 2. This system only runs in parallel with other systems that do not conflict with the System::archetype_component_access().

Initialize the system.

Update the system’s archetype component Access.

Gets the system’s last change tick

Sets the system’s last change tick

Warning

This is a complex and error-prone operation, that can have unexpected consequences on any system relying on this code. However, it can be an essential escape hatch when, for example, you are trying to synchronize representations using change detection and need to avoid infinite recursion.

Provided Methods§

Runs the system with the given input in the world.

The default labels for the system

Trait Implementations§

Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
Assigns a run criteria to the system. Can be a new descriptor or a label of a run criteria defined elsewhere. Read more
Assigns a label to the system; there can be more than one, and it doesn’t have to be unique.
Specifies that the system should run before systems with the given label.
Specifies that the system should run after systems with the given label.
Marks this system as ambiguous with any system with the specified label. This means that execution order between these systems does not matter, which allows some warnings to be silenced. Read more
Specifies that this system should opt out of execution order ambiguity detection. Read more
Specifies that the system should run with other exclusive systems at the start of stage.
Specifies that the system should run with other exclusive systems after the parallel systems and before command buffer application. Read more
Specifies that the system should run with other exclusive systems at the end of stage.
Assigns a label to the criteria. Must be unique.
Assigns a label to the criteria. If the given label is already in use, this criteria will be discarded before initialization. Read more
Specifies that this criteria must be evaluated before a criteria with the given label.
Specifies that this criteria must be evaluated after a criteria with the given label.

Implementors§