110 lines
45 KiB
HTML
110 lines
45 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Tools for controlling behavior in an ECS application."><title>bevy_ecs::system - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="bevy_ecs" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.0 (9fc6b4312 2025-01-07)" data-channel="1.84.0" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="icon" href="https://bevyengine.org/assets/icon.png"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button><a class="logo-container" href="../../bevy_ecs/index.html"><img src="https://bevyengine.org/assets/icon.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../bevy_ecs/index.html"><img src="https://bevyengine.org/assets/icon.png" alt="logo"></a><h2><a href="../../bevy_ecs/index.html">bevy_<wbr>ecs</a><span class="version">0.15.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module system</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#system-ordering" title="System ordering">System ordering</a><ul><li><a href="#example" title="Example">Example</a></li></ul></li><li><a href="#system-parameter-list" title="System parameter list">System parameter list</a></li></ul><h3><a href="#reexports">Module Items</a></h3><ul class="block"><li><a href="#reexports" title="Re-exports">Re-exports</a></li><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#traits" title="Traits">Traits</a></li><li><a href="#functions" title="Functions">Functions</a></li><li><a href="#types" title="Type Aliases">Type Aliases</a></li><li><a href="#derives" title="Derive Macros">Derive Macros</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate bevy_<wbr>ecs</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">bevy_ecs</a></span><h1>Module <span>system</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/bevy_ecs/system/mod.rs.html#1-1752">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Tools for controlling behavior in an ECS application.</p>
|
||
<p>Systems define how an ECS based application behaves.
|
||
Systems are added to a <a href="../schedule/struct.Schedule.html" title="struct bevy_ecs::schedule::Schedule"><code>Schedule</code></a>, which is then run.
|
||
A system is usually written as a normal function, which is automatically converted into a system.</p>
|
||
<p>System functions can have parameters, through which one can query and mutate Bevy ECS state.
|
||
Only types that implement <a href="trait.SystemParam.html" title="trait bevy_ecs::system::SystemParam"><code>SystemParam</code></a> can be used, automatically fetching data from
|
||
the <a href="../world/struct.World.html" title="struct bevy_ecs::world::World"><code>World</code></a>.</p>
|
||
<p>System functions often look like this:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">fn </span>update_score_system(
|
||
<span class="kw-2">mut </span>query: Query<(<span class="kw-2">&</span>Player, <span class="kw-2">&mut </span>Score)>,
|
||
<span class="kw-2">mut </span>round: ResMut<Round>,
|
||
) {
|
||
<span class="kw">for </span>(player, <span class="kw-2">mut </span>score) <span class="kw">in </span><span class="kw-2">&mut </span>query {
|
||
<span class="kw">if </span>player.alive {
|
||
score.<span class="number">0 </span>+= round.<span class="number">0</span>;
|
||
}
|
||
}
|
||
round.<span class="number">0 </span>+= <span class="number">1</span>;
|
||
}</code></pre></div>
|
||
<h2 id="system-ordering"><a class="doc-anchor" href="#system-ordering">§</a>System ordering</h2>
|
||
<p>By default, the execution of systems is parallel and not deterministic.
|
||
Not all systems can run together: if a system mutably accesses data,
|
||
no other system that reads or writes that data can be run at the same time.
|
||
These systems are said to be <strong>incompatible</strong>.</p>
|
||
<p>The relative order in which incompatible systems are run matters.
|
||
When this is not specified, a <strong>system order ambiguity</strong> exists in your schedule.
|
||
You can <strong>explicitly order</strong> systems:</p>
|
||
<ul>
|
||
<li>by calling the <code>.before(this_system)</code> or <code>.after(that_system)</code> methods when adding them to your schedule</li>
|
||
<li>by adding them to a <a href="../schedule/trait.SystemSet.html" title="trait bevy_ecs::schedule::SystemSet"><code>SystemSet</code></a>, and then using <code>.configure_sets(ThisSet.before(ThatSet))</code> syntax to configure many systems at once</li>
|
||
<li>through the use of <code>.add_systems((system_a, system_b, system_c).chain())</code></li>
|
||
</ul>
|
||
<h3 id="example"><a class="doc-anchor" href="#example">§</a>Example</h3>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="comment">// Configure these systems to run in order using `chain()`.
|
||
</span>schedule.add_systems((print_first, print_last).chain());
|
||
<span class="comment">// Prints "HelloWorld!"
|
||
</span>schedule.run(<span class="kw-2">&mut </span>world);
|
||
|
||
<span class="comment">// Configure this system to run in between the other two systems
|
||
// using explicit dependencies.
|
||
</span>schedule.add_systems(print_mid.after(print_first).before(print_last));
|
||
<span class="comment">// Prints "Hello, World!"
|
||
</span>schedule.run(<span class="kw-2">&mut </span>world);
|
||
|
||
<span class="kw">fn </span>print_first() {
|
||
<span class="macro">print!</span>(<span class="string">"Hello"</span>);
|
||
}
|
||
<span class="kw">fn </span>print_mid() {
|
||
<span class="macro">print!</span>(<span class="string">", "</span>);
|
||
}
|
||
<span class="kw">fn </span>print_last() {
|
||
<span class="macro">println!</span>(<span class="string">"World!"</span>);
|
||
}</code></pre></div>
|
||
<h2 id="system-parameter-list"><a class="doc-anchor" href="#system-parameter-list">§</a>System parameter list</h2>
|
||
<p>Following is the complete list of accepted types as system parameters:</p>
|
||
<ul>
|
||
<li><a href="struct.Query.html" title="struct bevy_ecs::system::Query"><code>Query</code></a></li>
|
||
<li><a href="../change_detection/struct.Res.html" title="struct bevy_ecs::change_detection::Res"><code>Res</code></a> and <code>Option<Res></code></li>
|
||
<li><a href="../change_detection/struct.ResMut.html" title="struct bevy_ecs::change_detection::ResMut"><code>ResMut</code></a> and <code>Option<ResMut></code></li>
|
||
<li><a href="struct.Commands.html" title="struct bevy_ecs::system::Commands"><code>Commands</code></a></li>
|
||
<li><a href="struct.Local.html" title="struct bevy_ecs::system::Local"><code>Local</code></a></li>
|
||
<li><a href="../event/struct.EventReader.html" title="struct bevy_ecs::event::EventReader"><code>EventReader</code></a></li>
|
||
<li><a href="../event/struct.EventWriter.html" title="struct bevy_ecs::event::EventWriter"><code>EventWriter</code></a></li>
|
||
<li><a href="struct.NonSend.html" title="struct bevy_ecs::system::NonSend"><code>NonSend</code></a> and <code>Option<NonSend></code></li>
|
||
<li><a href="../change_detection/struct.NonSendMut.html" title="struct bevy_ecs::change_detection::NonSendMut"><code>NonSendMut</code></a> and <code>Option<NonSendMut></code></li>
|
||
<li><a href="../removal_detection/struct.RemovedComponents.html" title="struct bevy_ecs::removal_detection::RemovedComponents"><code>RemovedComponents</code></a></li>
|
||
<li><a href="struct.SystemName.html" title="struct bevy_ecs::system::SystemName"><code>SystemName</code></a></li>
|
||
<li><a href="struct.SystemChangeTick.html" title="struct bevy_ecs::system::SystemChangeTick"><code>SystemChangeTick</code></a></li>
|
||
<li><a href="../archetype/struct.Archetypes.html" title="struct bevy_ecs::archetype::Archetypes"><code>Archetypes</code></a> (Provides Archetype metadata)</li>
|
||
<li><a href="../bundle/struct.Bundles.html" title="struct bevy_ecs::bundle::Bundles"><code>Bundles</code></a> (Provides Bundles metadata)</li>
|
||
<li><a href="../component/struct.Components.html" title="struct bevy_ecs::component::Components"><code>Components</code></a> (Provides Components metadata)</li>
|
||
<li><a href="../entity/struct.Entities.html" title="struct bevy_ecs::entity::Entities"><code>Entities</code></a> (Provides Entities metadata)</li>
|
||
<li>All tuples between 1 to 16 elements where each element implements <a href="trait.SystemParam.html" title="trait bevy_ecs::system::SystemParam"><code>SystemParam</code></a></li>
|
||
<li><a href="struct.ParamSet.html" title="struct bevy_ecs::system::ParamSet"><code>ParamSet</code></a></li>
|
||
<li><a href="https://doc.rust-lang.org/stable/std/primitive.unit.html"><code>()</code> (unit primitive type)</a></li>
|
||
</ul>
|
||
<p>In addition, the following parameters can be used when constructing a dynamic system with <a href="trait.SystemParamBuilder.html" title="trait bevy_ecs::system::SystemParamBuilder"><code>SystemParamBuilder</code></a>,
|
||
but will only provide an empty value when used with an ordinary system:</p>
|
||
<ul>
|
||
<li><a href="../world/struct.FilteredResources.html" title="struct bevy_ecs::world::FilteredResources"><code>FilteredResources</code></a></li>
|
||
<li><a href="../world/struct.FilteredResourcesMut.html" title="struct bevy_ecs::world::FilteredResourcesMut"><code>FilteredResourcesMut</code></a></li>
|
||
<li><a href="struct.DynSystemParam.html" title="struct bevy_ecs::system::DynSystemParam"><code>DynSystemParam</code></a></li>
|
||
<li><a href="https://doc.rust-lang.org/1.84.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec"><code>Vec<P></code></a> where <code>P: SystemParam</code></li>
|
||
<li><a href="struct.ParamSet.html" title="struct bevy_ecs::system::ParamSet"><code>ParamSet<Vec<P>></code></a> where <code>P: SystemParam</code></li>
|
||
</ul>
|
||
</div></details><h2 id="reexports" class="section-header">Re-exports<a href="#reexports" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name" id="reexport.NonSendMut"><code>pub use crate::change_detection::<a class="struct" href="../change_detection/struct.NonSendMut.html" title="struct bevy_ecs::change_detection::NonSendMut">NonSendMut</a>;</code></div></li><li><div class="item-name" id="reexport.Res"><code>pub use crate::change_detection::<a class="struct" href="../change_detection/struct.Res.html" title="struct bevy_ecs::change_detection::Res">Res</a>;</code></div></li><li><div class="item-name" id="reexport.ResMut"><code>pub use crate::change_detection::<a class="struct" href="../change_detection/struct.ResMut.html" title="struct bevy_ecs::change_detection::ResMut">ResMut</a>;</code></div></li></ul><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="mod" href="lifetimeless/index.html" title="mod bevy_ecs::system::lifetimeless">lifetimeless</a></div><div class="desc docblock-short">Contains type aliases for built-in <a href="trait.SystemParam.html" title="trait bevy_ecs::system::SystemParam"><code>SystemParam</code></a>s with <code>'static</code> lifetimes.
|
||
This makes it more convenient to refer to these types in contexts where
|
||
explicit lifetime annotations are required.</div></li></ul><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.AdapterSystem.html" title="struct bevy_ecs::system::AdapterSystem">Adapter<wbr>System</a></div><div class="desc docblock-short">A <a href="trait.System.html" title="trait bevy_ecs::system::System"><code>System</code></a> that takes the output of <code>S</code> and transforms it by applying <code>Func</code> to it.</div></li><li><div class="item-name"><a class="struct" href="struct.CachedSystemId.html" title="struct bevy_ecs::system::CachedSystemId">Cached<wbr>System<wbr>Id</a></div><div class="desc docblock-short">A cached <a href="struct.SystemId.html" title="struct bevy_ecs::system::SystemId"><code>SystemId</code></a> distinguished by the unique function type of its system.</div></li><li><div class="item-name"><a class="struct" href="struct.CombinatorSystem.html" title="struct bevy_ecs::system::CombinatorSystem">Combinator<wbr>System</a></div><div class="desc docblock-short">A <a href="trait.System.html" title="trait bevy_ecs::system::System"><code>System</code></a> defined by combining two other systems.
|
||
The behavior of this combinator is specified by implementing the <a href="trait.Combine.html" title="trait bevy_ecs::system::Combine"><code>Combine</code></a> trait.
|
||
For a full usage example, see the docs for <a href="trait.Combine.html" title="trait bevy_ecs::system::Combine"><code>Combine</code></a>.</div></li><li><div class="item-name"><a class="struct" href="struct.Commands.html" title="struct bevy_ecs::system::Commands">Commands</a></div><div class="desc docblock-short">A <a href="../world/trait.Command.html" title="trait bevy_ecs::world::Command"><code>Command</code></a> queue to perform structural changes to the <a href="../world/struct.World.html" title="struct bevy_ecs::world::World"><code>World</code></a>.</div></li><li><div class="item-name"><a class="struct" href="struct.Deferred.html" title="struct bevy_ecs::system::Deferred">Deferred</a></div><div class="desc docblock-short">A <a href="trait.SystemParam.html" title="trait bevy_ecs::system::SystemParam"><code>SystemParam</code></a> that stores a buffer which gets applied to the <a href="../world/struct.World.html" title="struct bevy_ecs::world::World"><code>World</code></a> during
|
||
<a href="../schedule/fn.apply_deferred.html" title="fn bevy_ecs::schedule::apply_deferred"><code>apply_deferred</code></a>.
|
||
This is used internally by <a href="struct.Commands.html" title="struct bevy_ecs::system::Commands"><code>Commands</code></a> to defer <code>World</code> mutations.</div></li><li><div class="item-name"><a class="struct" href="struct.DynParamBuilder.html" title="struct bevy_ecs::system::DynParamBuilder">DynParam<wbr>Builder</a></div><div class="desc docblock-short">A <a href="trait.SystemParamBuilder.html" title="trait bevy_ecs::system::SystemParamBuilder"><code>SystemParamBuilder</code></a> for a <a href="struct.DynSystemParam.html" title="struct bevy_ecs::system::DynSystemParam"><code>DynSystemParam</code></a>.
|
||
See the <a href="struct.DynSystemParam.html" title="struct bevy_ecs::system::DynSystemParam"><code>DynSystemParam</code></a> docs for examples.</div></li><li><div class="item-name"><a class="struct" href="struct.DynSystemParam.html" title="struct bevy_ecs::system::DynSystemParam">DynSystem<wbr>Param</a></div><div class="desc docblock-short">A <a href="trait.SystemParam.html" title="trait bevy_ecs::system::SystemParam"><code>SystemParam</code></a> with a type that can be configured at runtime.</div></li><li><div class="item-name"><a class="struct" href="struct.DynSystemParamState.html" title="struct bevy_ecs::system::DynSystemParamState">DynSystem<wbr>Param<wbr>State</a></div><div class="desc docblock-short">The <a href="trait.SystemParam.html#associatedtype.State" title="associated type bevy_ecs::system::SystemParam::State"><code>SystemParam::State</code></a> for a <a href="struct.DynSystemParam.html" title="struct bevy_ecs::system::DynSystemParam"><code>DynSystemParam</code></a>.</div></li><li><div class="item-name"><a class="struct" href="struct.EntityCommands.html" title="struct bevy_ecs::system::EntityCommands">Entity<wbr>Commands</a></div><div class="desc docblock-short">A list of commands that will be run to modify an <a href="../entity/index.html" title="mod bevy_ecs::entity">entity</a>.</div></li><li><div class="item-name"><a class="struct" href="struct.EntityEntryCommands.html" title="struct bevy_ecs::system::EntityEntryCommands">Entity<wbr>Entry<wbr>Commands</a></div><div class="desc docblock-short">A wrapper around <a href="struct.EntityCommands.html" title="struct bevy_ecs::system::EntityCommands"><code>EntityCommands</code></a> with convenience methods for working with a specified component type.</div></li><li><div class="item-name"><a class="struct" href="struct.ExclusiveFunctionSystem.html" title="struct bevy_ecs::system::ExclusiveFunctionSystem">Exclusive<wbr>Function<wbr>System</a></div><div class="desc docblock-short">A function system that runs with exclusive <a href="../world/struct.World.html" title="struct bevy_ecs::world::World"><code>World</code></a> access.</div></li><li><div class="item-name"><a class="struct" href="struct.FilteredResourcesMutParamBuilder.html" title="struct bevy_ecs::system::FilteredResourcesMutParamBuilder">Filtered<wbr>Resources<wbr>MutParam<wbr>Builder</a></div><div class="desc docblock-short">A <a href="trait.SystemParamBuilder.html" title="trait bevy_ecs::system::SystemParamBuilder"><code>SystemParamBuilder</code></a> for a <a href="../world/struct.FilteredResourcesMut.html" title="struct bevy_ecs::world::FilteredResourcesMut"><code>FilteredResourcesMut</code></a>.
|
||
See the <a href="../world/struct.FilteredResourcesMut.html" title="struct bevy_ecs::world::FilteredResourcesMut"><code>FilteredResourcesMut</code></a> docs for examples.</div></li><li><div class="item-name"><a class="struct" href="struct.FilteredResourcesParamBuilder.html" title="struct bevy_ecs::system::FilteredResourcesParamBuilder">Filtered<wbr>Resources<wbr>Param<wbr>Builder</a></div><div class="desc docblock-short">A <a href="trait.SystemParamBuilder.html" title="trait bevy_ecs::system::SystemParamBuilder"><code>SystemParamBuilder</code></a> for a <a href="../world/struct.FilteredResources.html" title="struct bevy_ecs::world::FilteredResources"><code>FilteredResources</code></a>.
|
||
See the <a href="../world/struct.FilteredResources.html" title="struct bevy_ecs::world::FilteredResources"><code>FilteredResources</code></a> docs for examples.</div></li><li><div class="item-name"><a class="struct" href="struct.FunctionSystem.html" title="struct bevy_ecs::system::FunctionSystem">Function<wbr>System</a></div><div class="desc docblock-short">The <a href="trait.System.html" title="trait bevy_ecs::system::System"><code>System</code></a> counter part of an ordinary function.</div></li><li><div class="item-name"><a class="struct" href="struct.In.html" title="struct bevy_ecs::system::In">In</a></div><div class="desc docblock-short">A <a href="trait.SystemInput.html" title="trait bevy_ecs::system::SystemInput"><code>SystemInput</code></a> type which denotes that a <a href="trait.System.html" title="trait bevy_ecs::system::System"><code>System</code></a> receives
|
||
an input value of type <code>T</code> from its caller.</div></li><li><div class="item-name"><a class="struct" href="struct.InMut.html" title="struct bevy_ecs::system::InMut">InMut</a></div><div class="desc docblock-short">A <a href="trait.SystemInput.html" title="trait bevy_ecs::system::SystemInput"><code>SystemInput</code></a> type which denotes that a <a href="trait.System.html" title="trait bevy_ecs::system::System"><code>System</code></a> receives
|
||
a mutable reference to a value of type <code>T</code> from its caller.</div></li><li><div class="item-name"><a class="struct" href="struct.InRef.html" title="struct bevy_ecs::system::InRef">InRef</a></div><div class="desc docblock-short">A <a href="trait.SystemInput.html" title="trait bevy_ecs::system::SystemInput"><code>SystemInput</code></a> type which denotes that a <a href="trait.System.html" title="trait bevy_ecs::system::System"><code>System</code></a> receives
|
||
a read-only reference to a value of type <code>T</code> from its caller.</div></li><li><div class="item-name"><a class="struct" href="struct.IntoAdapterSystem.html" title="struct bevy_ecs::system::IntoAdapterSystem">Into<wbr>Adapter<wbr>System</a></div><div class="desc docblock-short">An <a href="trait.IntoSystem.html" title="trait bevy_ecs::system::IntoSystem"><code>IntoSystem</code></a> creating an instance of <a href="struct.AdapterSystem.html" title="struct bevy_ecs::system::AdapterSystem"><code>AdapterSystem</code></a>.</div></li><li><div class="item-name"><a class="struct" href="struct.IntoPipeSystem.html" title="struct bevy_ecs::system::IntoPipeSystem">Into<wbr>Pipe<wbr>System</a></div><div class="desc docblock-short">An <a href="trait.IntoSystem.html" title="trait bevy_ecs::system::IntoSystem"><code>IntoSystem</code></a> creating an instance of <a href="struct.PipeSystem.html" title="struct bevy_ecs::system::PipeSystem"><code>PipeSystem</code></a>.</div></li><li><div class="item-name"><a class="struct" href="struct.Local.html" title="struct bevy_ecs::system::Local">Local</a></div><div class="desc docblock-short">A system local <a href="trait.SystemParam.html" title="trait bevy_ecs::system::SystemParam"><code>SystemParam</code></a>.</div></li><li><div class="item-name"><a class="struct" href="struct.LocalBuilder.html" title="struct bevy_ecs::system::LocalBuilder">Local<wbr>Builder</a></div><div class="desc docblock-short">A <a href="trait.SystemParamBuilder.html" title="trait bevy_ecs::system::SystemParamBuilder"><code>SystemParamBuilder</code></a> for a <a href="struct.Local.html" title="struct bevy_ecs::system::Local"><code>Local</code></a>.
|
||
The provided value will be used as the initial value of the <code>Local</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.NonSend.html" title="struct bevy_ecs::system::NonSend">NonSend</a></div><div class="desc docblock-short">Shared borrow of a non-<a href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Send.html" title="trait core::marker::Send"><code>Send</code></a> resource.</div></li><li><div class="item-name"><a class="struct" href="struct.ParallelCommands.html" title="struct bevy_ecs::system::ParallelCommands">Parallel<wbr>Commands</a></div><div class="desc docblock-short">An alternative to <a href="struct.Commands.html" title="struct bevy_ecs::system::Commands"><code>Commands</code></a> that can be used in parallel contexts, such as those
|
||
in <a href="struct.Query.html#method.par_iter" title="method bevy_ecs::system::Query::par_iter"><code>Query::par_iter</code></a>.</div></li><li><div class="item-name"><a class="struct" href="struct.ParamBuilder.html" title="struct bevy_ecs::system::ParamBuilder">Param<wbr>Builder</a></div><div class="desc docblock-short">A <a href="trait.SystemParamBuilder.html" title="trait bevy_ecs::system::SystemParamBuilder"><code>SystemParamBuilder</code></a> for any <a href="trait.SystemParam.html" title="trait bevy_ecs::system::SystemParam"><code>SystemParam</code></a> that uses its default initialization.</div></li><li><div class="item-name"><a class="struct" href="struct.ParamSet.html" title="struct bevy_ecs::system::ParamSet">Param<wbr>Set</a></div><div class="desc docblock-short">A collection of potentially conflicting <a href="trait.SystemParam.html" title="trait bevy_ecs::system::SystemParam"><code>SystemParam</code></a>s allowed by disjoint access.</div></li><li><div class="item-name"><a class="struct" href="struct.ParamSetBuilder.html" title="struct bevy_ecs::system::ParamSetBuilder">Param<wbr>SetBuilder</a></div><div class="desc docblock-short">A <a href="trait.SystemParamBuilder.html" title="trait bevy_ecs::system::SystemParamBuilder"><code>SystemParamBuilder</code></a> for a <a href="struct.ParamSet.html" title="struct bevy_ecs::system::ParamSet"><code>ParamSet</code></a>.</div></li><li><div class="item-name"><a class="struct" href="struct.PipeSystem.html" title="struct bevy_ecs::system::PipeSystem">Pipe<wbr>System</a></div><div class="desc docblock-short">A <a href="trait.System.html" title="trait bevy_ecs::system::System"><code>System</code></a> created by piping the output of the first system into the input of the second.</div></li><li><div class="item-name"><a class="struct" href="struct.Populated.html" title="struct bevy_ecs::system::Populated">Populated</a></div><div class="desc docblock-short"><a href="trait.SystemParam.html" title="trait bevy_ecs::system::SystemParam">System parameter</a> that works very much like <a href="struct.Query.html" title="struct bevy_ecs::system::Query"><code>Query</code></a> except it always contains at least one matching entity.</div></li><li><div class="item-name"><a class="struct" href="struct.Query.html" title="struct bevy_ecs::system::Query">Query</a></div><div class="desc docblock-short"><a href="trait.SystemParam.html" title="trait bevy_ecs::system::SystemParam">System parameter</a> that provides selective access to the <a href="../component/trait.Component.html" title="trait bevy_ecs::component::Component"><code>Component</code></a> data stored in a <a href="../world/struct.World.html" title="struct bevy_ecs::world::World"><code>World</code></a>.</div></li><li><div class="item-name"><a class="struct" href="struct.QueryLens.html" title="struct bevy_ecs::system::QueryLens">Query<wbr>Lens</a></div><div class="desc docblock-short">Type returned from <a href="struct.Query.html#method.transmute_lens" title="method bevy_ecs::system::Query::transmute_lens"><code>Query::transmute_lens</code></a> containing the new <a href="../query/struct.QueryState.html" title="struct bevy_ecs::query::QueryState"><code>QueryState</code></a>.</div></li><li><div class="item-name"><a class="struct" href="struct.QueryParamBuilder.html" title="struct bevy_ecs::system::QueryParamBuilder">Query<wbr>Param<wbr>Builder</a></div><div class="desc docblock-short">A <a href="trait.SystemParamBuilder.html" title="trait bevy_ecs::system::SystemParamBuilder"><code>SystemParamBuilder</code></a> for a <a href="struct.Query.html" title="struct bevy_ecs::system::Query"><code>Query</code></a>.
|
||
This takes a closure accepting an <code>&mut</code> <a href="../query/struct.QueryBuilder.html" title="struct bevy_ecs::query::QueryBuilder"><code>QueryBuilder</code></a> and uses the builder to construct the query’s state.
|
||
This can be used to add additional filters,
|
||
or to configure the components available to <a href="../world/struct.FilteredEntityRef.html" title="struct bevy_ecs::world::FilteredEntityRef"><code>FilteredEntityRef</code></a> or <a href="../world/struct.FilteredEntityMut.html" title="struct bevy_ecs::world::FilteredEntityMut"><code>FilteredEntityMut</code></a>.</div></li><li><div class="item-name"><a class="struct" href="struct.RegisterSystem.html" title="struct bevy_ecs::system::RegisterSystem">Register<wbr>System</a></div><div class="desc docblock-short">The <a href="../world/trait.Command.html" title="trait bevy_ecs::world::Command"><code>Command</code></a> type for registering one shot systems from <a href="struct.Commands.html" title="struct bevy_ecs::system::Commands"><code>Commands</code></a>.</div></li><li><div class="item-name"><a class="struct" href="struct.RemovedSystem.html" title="struct bevy_ecs::system::RemovedSystem">Removed<wbr>System</a></div><div class="desc docblock-short">A system that has been removed from the registry.
|
||
It contains the system and whether or not it has been initialized.</div></li><li><div class="item-name"><a class="struct" href="struct.RunSystemCachedWith.html" title="struct bevy_ecs::system::RunSystemCachedWith">RunSystem<wbr>Cached<wbr>With</a></div><div class="desc docblock-short">The <a href="../world/trait.Command.html" title="trait bevy_ecs::world::Command"><code>Command</code></a> type for running a cached one-shot system from
|
||
<a href="struct.Commands.html" title="struct bevy_ecs::system::Commands"><code>Commands</code></a>.</div></li><li><div class="item-name"><a class="struct" href="struct.RunSystemWithInput.html" title="struct bevy_ecs::system::RunSystemWithInput">RunSystem<wbr>With<wbr>Input</a></div><div class="desc docblock-short">The <a href="../world/trait.Command.html" title="trait bevy_ecs::world::Command"><code>Command</code></a> type for <a href="../world/struct.World.html#method.run_system" title="method bevy_ecs::world::World::run_system"><code>World::run_system</code></a> or <a href="../world/struct.World.html#method.run_system_with_input" title="method bevy_ecs::world::World::run_system_with_input"><code>World::run_system_with_input</code></a>.</div></li><li><div class="item-name"><a class="struct" href="struct.Single.html" title="struct bevy_ecs::system::Single">Single</a></div><div class="desc docblock-short"><a href="trait.SystemParam.html" title="trait bevy_ecs::system::SystemParam">System parameter</a> that provides access to single entity’s components, much like <a href="struct.Query.html#method.single" title="method bevy_ecs::system::Query::single"><code>Query::single</code></a>/<a href="struct.Query.html#method.single_mut" title="method bevy_ecs::system::Query::single_mut"><code>Query::single_mut</code></a>.</div></li><li><div class="item-name"><a class="struct" href="struct.StaticSystemInput.html" title="struct bevy_ecs::system::StaticSystemInput">Static<wbr>System<wbr>Input</a></div><div class="desc docblock-short">A helper for using <a href="trait.SystemInput.html" title="trait bevy_ecs::system::SystemInput"><code>SystemInput</code></a>s in generic contexts.</div></li><li><div class="item-name"><a class="struct" href="struct.StaticSystemParam.html" title="struct bevy_ecs::system::StaticSystemParam">Static<wbr>System<wbr>Param</a></div><div class="desc docblock-short">A helper for using system parameters in generic contexts</div></li><li><div class="item-name"><a class="struct" href="struct.SystemChangeTick.html" title="struct bevy_ecs::system::SystemChangeTick">System<wbr>Change<wbr>Tick</a></div><div class="desc docblock-short">A <a href="trait.SystemParam.html" title="trait bevy_ecs::system::SystemParam"><code>SystemParam</code></a> that reads the previous and current change ticks of the system.</div></li><li><div class="item-name"><a class="struct" href="struct.SystemId.html" title="struct bevy_ecs::system::SystemId">System<wbr>Id</a></div><div class="desc docblock-short">An identifier for a registered system.</div></li><li><div class="item-name"><a class="struct" href="struct.SystemIdMarker.html" title="struct bevy_ecs::system::SystemIdMarker">System<wbr>IdMarker</a></div><div class="desc docblock-short">Marker <a href="../component/trait.Component.html" title="trait bevy_ecs::component::Component"><code>Component</code></a> for identifying <a href="struct.SystemId.html" title="struct bevy_ecs::system::SystemId"><code>SystemId</code></a> <a href="../entity/struct.Entity.html" title="struct bevy_ecs::entity::Entity"><code>Entity</code></a>s.</div></li><li><div class="item-name"><a class="struct" href="struct.SystemMeta.html" title="struct bevy_ecs::system::SystemMeta">System<wbr>Meta</a></div><div class="desc docblock-short">The metadata of a <a href="trait.System.html" title="trait bevy_ecs::system::System"><code>System</code></a>.</div></li><li><div class="item-name"><a class="struct" href="struct.SystemName.html" title="struct bevy_ecs::system::SystemName">System<wbr>Name</a></div><div class="desc docblock-short"><a href="trait.SystemParam.html" title="trait bevy_ecs::system::SystemParam"><code>SystemParam</code></a> that returns the name of the system which it is used in.</div></li><li><div class="item-name"><a class="struct" href="struct.SystemState.html" title="struct bevy_ecs::system::SystemState">System<wbr>State</a></div><div class="desc docblock-short">Holds on to persistent state required to drive <a href="trait.SystemParam.html" title="trait bevy_ecs::system::SystemParam"><code>SystemParam</code></a> for a <a href="trait.System.html" title="trait bevy_ecs::system::System"><code>System</code></a>.</div></li><li><div class="item-name"><a class="struct" href="struct.UnregisterSystem.html" title="struct bevy_ecs::system::UnregisterSystem">Unregister<wbr>System</a></div><div class="desc docblock-short">The <a href="../world/trait.Command.html" title="trait bevy_ecs::world::Command"><code>Command</code></a> type for unregistering one-shot systems from <a href="struct.Commands.html" title="struct bevy_ecs::system::Commands"><code>Commands</code></a>.</div></li></ul><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="enum" href="enum.ParamWarnPolicy.html" title="enum bevy_ecs::system::ParamWarnPolicy">Param<wbr>Warn<wbr>Policy</a></div><div class="desc docblock-short">State machine for emitting warnings when <a href="trait.System.html#method.validate_param" title="method bevy_ecs::system::System::validate_param">system params are invalid</a>.</div></li><li><div class="item-name"><a class="enum" href="enum.RegisteredSystemError.html" title="enum bevy_ecs::system::RegisteredSystemError">Registered<wbr>System<wbr>Error</a></div><div class="desc docblock-short">An operation with stored systems failed.</div></li><li><div class="item-name"><a class="enum" href="enum.RunSystemError.html" title="enum bevy_ecs::system::RunSystemError">RunSystem<wbr>Error</a></div><div class="desc docblock-short">Running system failed.</div></li></ul><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="trait" href="trait.Adapt.html" title="trait bevy_ecs::system::Adapt">Adapt</a></div><div class="desc docblock-short">Customizes the behavior of an <a href="struct.AdapterSystem.html" title="struct bevy_ecs::system::AdapterSystem"><code>AdapterSystem</code></a></div></li><li><div class="item-name"><a class="trait" href="trait.Combine.html" title="trait bevy_ecs::system::Combine">Combine</a></div><div class="desc docblock-short">Customizes the behavior of a <a href="struct.CombinatorSystem.html" title="struct bevy_ecs::system::CombinatorSystem"><code>CombinatorSystem</code></a>.</div></li><li><div class="item-name"><a class="trait" href="trait.EntityCommand.html" title="trait bevy_ecs::system::EntityCommand">Entity<wbr>Command</a></div><div class="desc docblock-short">A <a href="../world/trait.Command.html" title="trait bevy_ecs::world::Command"><code>Command</code></a> which gets executed for a given <a href="../entity/struct.Entity.html" title="struct bevy_ecs::entity::Entity"><code>Entity</code></a>.</div></li><li><div class="item-name"><a class="trait" href="trait.ExclusiveSystemParam.html" title="trait bevy_ecs::system::ExclusiveSystemParam">Exclusive<wbr>System<wbr>Param</a></div><div class="desc docblock-short">A parameter that can be used in an exclusive system (a system with an <code>&mut World</code> parameter).
|
||
Any parameters implementing this trait must come after the <code>&mut World</code> parameter.</div></li><li><div class="item-name"><a class="trait" href="trait.ExclusiveSystemParamFunction.html" title="trait bevy_ecs::system::ExclusiveSystemParamFunction">Exclusive<wbr>System<wbr>Param<wbr>Function</a></div><div class="desc docblock-short">A trait implemented for all exclusive system functions that can be used as <a href="trait.System.html" title="trait bevy_ecs::system::System"><code>System</code></a>s.</div></li><li><div class="item-name"><a class="trait" href="trait.IntoObserverSystem.html" title="trait bevy_ecs::system::IntoObserverSystem">Into<wbr>Observer<wbr>System</a></div><div class="desc docblock-short">Implemented for systems that convert into <a href="trait.ObserverSystem.html" title="trait bevy_ecs::system::ObserverSystem"><code>ObserverSystem</code></a>.</div></li><li><div class="item-name"><a class="trait" href="trait.IntoSystem.html" title="trait bevy_ecs::system::IntoSystem">Into<wbr>System</a></div><div class="desc docblock-short">Conversion trait to turn something into a <a href="trait.System.html" title="trait bevy_ecs::system::System"><code>System</code></a>.</div></li><li><div class="item-name"><a class="trait" href="trait.ObserverSystem.html" title="trait bevy_ecs::system::ObserverSystem">Observer<wbr>System</a></div><div class="desc docblock-short">Implemented for <a href="trait.System.html" title="trait bevy_ecs::system::System"><code>System</code></a>s that have a <a href="../observer/struct.Trigger.html" title="struct bevy_ecs::observer::Trigger"><code>Trigger</code></a> as the first argument.</div></li><li><div class="item-name"><a class="trait" href="trait.ReadOnlySystem.html" title="trait bevy_ecs::system::ReadOnlySystem">Read<wbr>Only<wbr>System</a></div><div class="desc docblock-short"><a href="trait.System.html" title="trait bevy_ecs::system::System"><code>System</code></a> types that do not modify the <a href="../world/struct.World.html" title="struct bevy_ecs::world::World"><code>World</code></a> when run.
|
||
This is implemented for any systems whose parameters all implement <a href="trait.ReadOnlySystemParam.html" title="trait bevy_ecs::system::ReadOnlySystemParam"><code>ReadOnlySystemParam</code></a>.</div></li><li><div class="item-name"><a class="trait" href="trait.ReadOnlySystemParam.html" title="trait bevy_ecs::system::ReadOnlySystemParam">Read<wbr>Only<wbr>System<wbr>Param</a></div><div class="desc docblock-short">A <a href="trait.SystemParam.html" title="trait bevy_ecs::system::SystemParam"><code>SystemParam</code></a> that only reads a given <a href="../world/struct.World.html" title="struct bevy_ecs::world::World"><code>World</code></a>.</div></li><li><div class="item-name"><a class="trait" href="trait.Resource.html" title="trait bevy_ecs::system::Resource">Resource</a></div><div class="desc docblock-short">A type that can be inserted into a <a href="../world/struct.World.html" title="struct bevy_ecs::world::World"><code>World</code></a> as a singleton.</div></li><li><div class="item-name"><a class="trait" href="trait.RunSystemOnce.html" title="trait bevy_ecs::system::RunSystemOnce">RunSystem<wbr>Once</a></div><div class="desc docblock-short">Trait used to run a system immediately on a <a href="../world/struct.World.html" title="struct bevy_ecs::world::World"><code>World</code></a>.</div></li><li><div class="item-name"><a class="trait" href="trait.System.html" title="trait bevy_ecs::system::System">System</a></div><div class="desc docblock-short">An ECS system that can be added to a <a href="../schedule/struct.Schedule.html" title="struct bevy_ecs::schedule::Schedule"><code>Schedule</code></a></div></li><li><div class="item-name"><a class="trait" href="trait.SystemBuffer.html" title="trait bevy_ecs::system::SystemBuffer">System<wbr>Buffer</a></div><div class="desc docblock-short">Types that can be used with <a href="struct.Deferred.html" title="struct bevy_ecs::system::Deferred"><code>Deferred<T></code></a> in systems.
|
||
This allows storing system-local data which is used to defer <a href="../world/struct.World.html" title="struct bevy_ecs::world::World"><code>World</code></a> mutations.</div></li><li><div class="item-name"><a class="trait" href="trait.SystemInput.html" title="trait bevy_ecs::system::SystemInput">System<wbr>Input</a></div><div class="desc docblock-short">Trait for types that can be used as input to <a href="trait.System.html" title="trait bevy_ecs::system::System"><code>System</code></a>s.</div></li><li><div class="item-name"><a class="trait" href="trait.SystemParam.html" title="trait bevy_ecs::system::SystemParam">System<wbr>Param</a></div><div class="desc docblock-short">A parameter that can be used in a <a href="trait.System.html" title="trait bevy_ecs::system::System"><code>System</code></a>.</div></li><li><div class="item-name"><a class="trait" href="trait.SystemParamBuilder.html" title="trait bevy_ecs::system::SystemParamBuilder">System<wbr>Param<wbr>Builder</a></div><div class="desc docblock-short">A builder that can create a <a href="trait.SystemParam.html" title="trait bevy_ecs::system::SystemParam"><code>SystemParam</code></a>.</div></li><li><div class="item-name"><a class="trait" href="trait.SystemParamFunction.html" title="trait bevy_ecs::system::SystemParamFunction">System<wbr>Param<wbr>Function</a></div><div class="desc docblock-short">A trait implemented for all functions that can be used as <a href="trait.System.html" title="trait bevy_ecs::system::System"><code>System</code></a>s.</div></li></ul><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="fn" href="fn.assert_is_read_only_system.html" title="fn bevy_ecs::system::assert_is_read_only_system">assert_<wbr>is_<wbr>read_<wbr>only_<wbr>system</a></div><div class="desc docblock-short">Ensure that a given function is a <a href="trait.ReadOnlySystem.html" title="trait bevy_ecs::system::ReadOnlySystem">read-only system</a>.</div></li><li><div class="item-name"><a class="fn" href="fn.assert_is_system.html" title="fn bevy_ecs::system::assert_is_system">assert_<wbr>is_<wbr>system</a></div><div class="desc docblock-short">Ensure that a given function is a <a href="trait.System.html" title="trait bevy_ecs::system::System">system</a>.</div></li><li><div class="item-name"><a class="fn" href="fn.assert_system_does_not_conflict.html" title="fn bevy_ecs::system::assert_system_does_not_conflict">assert_<wbr>system_<wbr>does_<wbr>not_<wbr>conflict</a></div><div class="desc docblock-short">Ensures that the provided system doesn’t conflict with itself.</div></li></ul><h2 id="types" class="section-header">Type Aliases<a href="#types" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="type" href="type.BoxedSystem.html" title="type bevy_ecs::system::BoxedSystem">Boxed<wbr>System</a></div><div class="desc docblock-short">A convenience type alias for a boxed <a href="trait.System.html" title="trait bevy_ecs::system::System"><code>System</code></a> trait object.</div></li><li><div class="item-name"><a class="type" href="type.ExclusiveSystemParamItem.html" title="type bevy_ecs::system::ExclusiveSystemParamItem">Exclusive<wbr>System<wbr>Param<wbr>Item</a></div><div class="desc docblock-short">Shorthand way of accessing the associated type <a href="trait.ExclusiveSystemParam.html#associatedtype.Item" title="associated type bevy_ecs::system::ExclusiveSystemParam::Item"><code>ExclusiveSystemParam::Item</code></a>
|
||
for a given <a href="trait.ExclusiveSystemParam.html" title="trait bevy_ecs::system::ExclusiveSystemParam"><code>ExclusiveSystemParam</code></a>.</div></li><li><div class="item-name"><a class="type" href="type.RunSystem.html" title="type bevy_ecs::system::RunSystem">RunSystem</a></div><div class="desc docblock-short">The <a href="../world/trait.Command.html" title="trait bevy_ecs::world::Command"><code>Command</code></a> type for <a href="../world/struct.World.html#method.run_system" title="method bevy_ecs::world::World::run_system"><code>World::run_system</code></a>.</div></li><li><div class="item-name"><a class="type" href="type.SystemIn.html" title="type bevy_ecs::system::SystemIn">System<wbr>In</a></div><div class="desc docblock-short">Shorthand way to get the <a href="trait.System.html#associatedtype.In" title="associated type bevy_ecs::system::System::In"><code>System::In</code></a> for a <a href="trait.System.html" title="trait bevy_ecs::system::System"><code>System</code></a> as a <a href="trait.SystemInput.html#associatedtype.Inner" title="associated type bevy_ecs::system::SystemInput::Inner"><code>SystemInput::Inner</code></a>.</div></li><li><div class="item-name"><a class="type" href="type.SystemParamItem.html" title="type bevy_ecs::system::SystemParamItem">System<wbr>Param<wbr>Item</a></div><div class="desc docblock-short">Shorthand way of accessing the associated type <a href="trait.SystemParam.html#associatedtype.Item" title="associated type bevy_ecs::system::SystemParam::Item"><code>SystemParam::Item</code></a> for a given <a href="trait.SystemParam.html" title="trait bevy_ecs::system::SystemParam"><code>SystemParam</code></a>.</div></li></ul><h2 id="derives" class="section-header">Derive Macros<a href="#derives" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="derive" href="derive.Resource.html" title="derive bevy_ecs::system::Resource">Resource</a></div></li><li><div class="item-name"><a class="derive" href="derive.SystemParam.html" title="derive bevy_ecs::system::SystemParam">System<wbr>Param</a></div><div class="desc docblock-short">Implement <code>SystemParam</code> to use a struct as a parameter in a system</div></li></ul></section></div></main></body></html> |