Files
phy/bevy_ecs/system/struct.Commands.html
Orion Kindel 0ce894e6b0 doc
2025-03-18 10:30:23 -05:00

467 lines
107 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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="A `Command` queue to perform structural changes to the `World`."><title>Commands in 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 struct"><!--[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="#">Commands</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#usage" title="Usage">Usage</a></li><li><a href="#implementing" title="Implementing">Implementing</a></li></ul><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.add_observer" title="add_observer">add_observer</a></li><li><a href="#method.append" title="append">append</a></li><li><a href="#method.entity" title="entity">entity</a></li><li><a href="#method.get_entity" title="get_entity">get_entity</a></li><li><a href="#method.get_or_spawn" title="get_or_spawn">get_or_spawn</a></li><li><a href="#method.init_resource" title="init_resource">init_resource</a></li><li><a href="#method.insert_batch" title="insert_batch">insert_batch</a></li><li><a href="#method.insert_batch_if_new" title="insert_batch_if_new">insert_batch_if_new</a></li><li><a href="#method.insert_or_spawn_batch" title="insert_or_spawn_batch">insert_or_spawn_batch</a></li><li><a href="#method.insert_resource" title="insert_resource">insert_resource</a></li><li><a href="#method.new" title="new">new</a></li><li><a href="#method.new_from_entities" title="new_from_entities">new_from_entities</a></li><li><a href="#method.queue" title="queue">queue</a></li><li><a href="#method.reborrow" title="reborrow">reborrow</a></li><li><a href="#method.register_system" title="register_system">register_system</a></li><li><a href="#method.remove_resource" title="remove_resource">remove_resource</a></li><li><a href="#method.run_system" title="run_system">run_system</a></li><li><a href="#method.run_system_cached" title="run_system_cached">run_system_cached</a></li><li><a href="#method.run_system_cached_with" title="run_system_cached_with">run_system_cached_with</a></li><li><a href="#method.run_system_with_input" title="run_system_with_input">run_system_with_input</a></li><li><a href="#method.send_event" title="send_event">send_event</a></li><li><a href="#method.spawn" title="spawn">spawn</a></li><li><a href="#method.spawn_batch" title="spawn_batch">spawn_batch</a></li><li><a href="#method.spawn_empty" title="spawn_empty">spawn_empty</a></li><li><a href="#method.trigger" title="trigger">trigger</a></li><li><a href="#method.trigger_targets" title="trigger_targets">trigger_targets</a></li><li><a href="#method.try_insert_batch" title="try_insert_batch">try_insert_batch</a></li><li><a href="#method.try_insert_batch_if_new" title="try_insert_batch_if_new">try_insert_batch_if_new</a></li><li><a href="#method.unregister_system" title="unregister_system">unregister_system</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block trait-implementation"><li><a href="#impl-ReadOnlySystemParam-for-Commands%3C'w,+'s%3E" title="ReadOnlySystemParam">ReadOnlySystemParam</a></li><li><a href="#impl-Send-for-Commands%3C'_,+'_%3E" title="Send">Send</a></li><li><a href="#impl-Sync-for-Commands%3C'_,+'_%3E" title="Sync">Sync</a></li><li><a href="#impl-SystemParam-for-Commands%3C'_,+'_%3E" title="SystemParam">SystemParam</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-UnwindSafe-for-Commands%3C'w,+'s%3E" title="!UnwindSafe">!UnwindSafe</a></li><li><a href="#impl-Freeze-for-Commands%3C'w,+'s%3E" title="Freeze">Freeze</a></li><li><a href="#impl-RefUnwindSafe-for-Commands%3C'w,+'s%3E" title="RefUnwindSafe">RefUnwindSafe</a></li><li><a href="#impl-Unpin-for-Commands%3C'w,+'s%3E" title="Unpin">Unpin</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T" title="Any">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T" title="Borrow&#60;T&#62;">Borrow&#60;T&#62;</a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T" title="BorrowMut&#60;T&#62;">BorrowMut&#60;T&#62;</a></li><li><a href="#impl-ConditionalSend-for-T" title="ConditionalSend">ConditionalSend</a></li><li><a href="#impl-Downcast-for-T" title="Downcast">Downcast</a></li><li><a href="#impl-DowncastSync-for-T" title="DowncastSync">DowncastSync</a></li><li><a href="#impl-From%3CT%3E-for-T" title="From&#60;T&#62;">From&#60;T&#62;</a></li><li><a href="#impl-Instrument-for-T" title="Instrument">Instrument</a></li><li><a href="#impl-Into%3CU%3E-for-T" title="Into&#60;U&#62;">Into&#60;U&#62;</a></li><li><a href="#impl-TryFrom%3CU%3E-for-T" title="TryFrom&#60;U&#62;">TryFrom&#60;U&#62;</a></li><li><a href="#impl-TryInto%3CU%3E-for-T" title="TryInto&#60;U&#62;">TryInto&#60;U&#62;</a></li><li><a href="#impl-VZip%3CV%3E-for-T" title="VZip&#60;V&#62;">VZip&#60;V&#62;</a></li><li><a href="#impl-WithSubscriber-for-T" title="WithSubscriber">WithSubscriber</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In bevy_<wbr>ecs::<wbr>system</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>::<wbr><a href="index.html">system</a></span><h1>Struct <span class="struct">Commands</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/commands/mod.rs.html#78-81">Source</a> </span></div><pre class="rust item-decl"><code>pub struct Commands&lt;'w, 's&gt; { <span class="comment">/* private fields */</span> }</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>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>.</p>
<p>Since each command requires exclusive access to the <code>World</code>,
all queued commands are automatically applied in sequence
when the <code>apply_deferred</code> system runs (see <a href="../schedule/fn.apply_deferred.html" title="fn bevy_ecs::schedule::apply_deferred"><code>apply_deferred</code></a> documentation for more details).</p>
<p>Each command can be used to modify the <a href="../world/struct.World.html" title="struct bevy_ecs::world::World"><code>World</code></a> in arbitrary ways:</p>
<ul>
<li>spawning or despawning entities</li>
<li>inserting components on new or existing entities</li>
<li>inserting resources</li>
<li>etc.</li>
</ul>
<p>For a version of <a href="struct.Commands.html" title="struct bevy_ecs::system::Commands"><code>Commands</code></a> that works in parallel contexts (such as
within <a href="struct.Query.html#method.par_iter" title="method bevy_ecs::system::Query::par_iter"><code>Query::par_iter</code></a>) see
<a href="struct.ParallelCommands.html" title="struct bevy_ecs::system::ParallelCommands"><code>ParallelCommands</code></a></p>
<h2 id="usage"><a class="doc-anchor" href="#usage">§</a>Usage</h2>
<p>Add <code>mut commands: Commands</code> as a function argument to your system to get a copy of this struct that will be applied the next time a copy of <a href="../schedule/fn.apply_deferred.html" title="fn bevy_ecs::schedule::apply_deferred"><code>apply_deferred</code></a> runs.
Commands are almost always used as a <a href="trait.SystemParam.html" title="trait bevy_ecs::system::SystemParam"><code>SystemParam</code></a>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">fn </span>my_system(<span class="kw-2">mut </span>commands: Commands) {
<span class="comment">// ...
</span>}</code></pre></div>
<h2 id="implementing"><a class="doc-anchor" href="#implementing">§</a>Implementing</h2>
<p>Each built-in command is implemented as a separate method, e.g. <a href="struct.Commands.html#method.spawn" title="method bevy_ecs::system::Commands::spawn"><code>Commands::spawn</code></a>.
In addition to the pre-defined command methods, you can add commands with any arbitrary
behavior using <a href="struct.Commands.html#method.queue" title="method bevy_ecs::system::Commands::queue"><code>Commands::queue</code></a>, which accepts any type implementing <a href="../world/trait.Command.html" title="trait bevy_ecs::world::Command"><code>Command</code></a>.</p>
<p>Since closures and other functions implement this trait automatically, this allows one-shot,
anonymous custom commands.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="comment">// NOTE: type inference fails here, so annotations are required on the closure.
</span>commands.queue(|w: <span class="kw-2">&amp;mut </span>World| {
<span class="comment">// Mutate the world however you want...
</span>});</code></pre></div>
</div></details><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Commands%3C'w,+'s%3E" class="impl"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#193-976">Source</a><a href="#impl-Commands%3C'w,+'s%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'w, 's&gt; <a class="struct" href="struct.Commands.html" title="struct bevy_ecs::system::Commands">Commands</a>&lt;'w, 's&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.new" class="method"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#199-201">Source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>(queue: &amp;'s mut <a class="struct" href="../world/struct.CommandQueue.html" title="struct bevy_ecs::world::CommandQueue">CommandQueue</a>, world: &amp;'w <a class="struct" href="../world/struct.World.html" title="struct bevy_ecs::world::World">World</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Returns a new <code>Commands</code> instance from a <a href="../world/struct.CommandQueue.html" title="struct bevy_ecs::world::CommandQueue"><code>CommandQueue</code></a> and a <a href="../world/struct.World.html" title="struct bevy_ecs::world::World"><code>World</code></a>.</p>
<p>It is not required to call this constructor when using <code>Commands</code> as a <a href="trait.SystemParam.html" title="trait bevy_ecs::system::SystemParam">system parameter</a>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.new_from_entities" class="method"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#208-213">Source</a><h4 class="code-header">pub fn <a href="#method.new_from_entities" class="fn">new_from_entities</a>(
queue: &amp;'s mut <a class="struct" href="../world/struct.CommandQueue.html" title="struct bevy_ecs::world::CommandQueue">CommandQueue</a>,
entities: &amp;'w <a class="struct" href="../entity/struct.Entities.html" title="struct bevy_ecs::entity::Entities">Entities</a>,
) -&gt; Self</h4></section></summary><div class="docblock"><p>Returns a new <code>Commands</code> instance from a <a href="../world/struct.CommandQueue.html" title="struct bevy_ecs::world::CommandQueue"><code>CommandQueue</code></a> and an <a href="../entity/struct.Entities.html" title="struct bevy_ecs::entity::Entities"><code>Entities</code></a> reference.</p>
<p>It is not required to call this constructor when using <code>Commands</code> as a <a href="trait.SystemParam.html" title="trait bevy_ecs::system::SystemParam">system parameter</a>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.reborrow" class="method"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#250-260">Source</a><h4 class="code-header">pub fn <a href="#method.reborrow" class="fn">reborrow</a>(&amp;mut self) -&gt; <a class="struct" href="struct.Commands.html" title="struct bevy_ecs::system::Commands">Commands</a>&lt;'w, '_&gt;</h4></section></summary><div class="docblock"><p>Returns a <a href="struct.Commands.html" title="struct bevy_ecs::system::Commands"><code>Commands</code></a> with a smaller lifetime.
This is useful if you have <code>&amp;mut Commands</code> but need <code>Commands</code>.</p>
<h5 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">fn </span>my_system(<span class="kw-2">mut </span>commands: Commands) {
<span class="comment">// We do our initialization in a separate function,
// which expects an owned `Commands`.
</span>do_initialization(commands.reborrow());
<span class="comment">// Since we only reborrowed the commands instead of moving them, we can still use them.
</span>commands.spawn_empty();
}</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.append" class="method"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#263-271">Source</a><h4 class="code-header">pub fn <a href="#method.append" class="fn">append</a>(&amp;mut self, other: &amp;mut <a class="struct" href="../world/struct.CommandQueue.html" title="struct bevy_ecs::world::CommandQueue">CommandQueue</a>)</h4></section></summary><div class="docblock"><p>Take all commands from <code>other</code> and append them to <code>self</code>, leaving <code>other</code> empty</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.spawn_empty" class="method"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#307-313">Source</a><h4 class="code-header">pub fn <a href="#method.spawn_empty" class="fn">spawn_empty</a>(&amp;mut self) -&gt; <a class="struct" href="struct.EntityCommands.html" title="struct bevy_ecs::system::EntityCommands">EntityCommands</a>&lt;'_&gt;</h4></section></summary><div class="docblock"><p>Reserves a new empty <a href="../entity/struct.Entity.html" title="struct bevy_ecs::entity::Entity"><code>Entity</code></a> to be spawned, and returns its corresponding <a href="struct.EntityCommands.html" title="struct bevy_ecs::system::EntityCommands"><code>EntityCommands</code></a>.</p>
<p>See <a href="../world/struct.World.html#method.spawn_empty" title="method bevy_ecs::world::World::spawn_empty"><code>World::spawn_empty</code></a> for more details.</p>
<h5 id="example"><a class="doc-anchor" href="#example">§</a>Example</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>
<span class="attr">#[derive(Component)]
</span><span class="kw">struct </span>Label(<span class="kw-2">&amp;</span><span class="lifetime">'static </span>str);
<span class="attr">#[derive(Component)]
</span><span class="kw">struct </span>Strength(u32);
<span class="attr">#[derive(Component)]
</span><span class="kw">struct </span>Agility(u32);
<span class="kw">fn </span>example_system(<span class="kw-2">mut </span>commands: Commands) {
<span class="comment">// Create a new empty entity and retrieve its id.
</span><span class="kw">let </span>empty_entity = commands.spawn_empty().id();
<span class="comment">// Create another empty entity, then add some component to it
</span>commands.spawn_empty()
<span class="comment">// adds a new component bundle to the entity
</span>.insert((Strength(<span class="number">1</span>), Agility(<span class="number">2</span>)))
<span class="comment">// adds a single component to the entity
</span>.insert(Label(<span class="string">"hello world"</span>));
}</code></pre></div>
<h5 id="see-also"><a class="doc-anchor" href="#see-also">§</a>See also</h5>
<ul>
<li><a href="struct.Commands.html#method.spawn" title="method bevy_ecs::system::Commands::spawn"><code>spawn</code></a> to spawn an entity with a bundle.</li>
<li><a href="struct.Commands.html#method.spawn_batch" title="method bevy_ecs::system::Commands::spawn_batch"><code>spawn_batch</code></a> to spawn entities with a bundle each.</li>
</ul>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_or_spawn" class="method"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#330-339">Source</a><h4 class="code-header">pub fn <a href="#method.get_or_spawn" class="fn">get_or_spawn</a>(&amp;mut self, entity: <a class="struct" href="../entity/struct.Entity.html" title="struct bevy_ecs::entity::Entity">Entity</a>) -&gt; <a class="struct" href="struct.EntityCommands.html" title="struct bevy_ecs::system::EntityCommands">EntityCommands</a>&lt;'_&gt;</h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.15.0: use Commands::spawn instead</span></div></span></summary><div class="docblock"><p>Pushes a <a href="../world/trait.Command.html" title="trait bevy_ecs::world::Command"><code>Command</code></a> to the queue for creating a new <a href="../entity/struct.Entity.html" title="struct bevy_ecs::entity::Entity"><code>Entity</code></a> if the given one does not exists,
and returns its corresponding <a href="struct.EntityCommands.html" title="struct bevy_ecs::system::EntityCommands"><code>EntityCommands</code></a>.</p>
<p>This method silently fails by returning <a href="struct.EntityCommands.html" title="struct bevy_ecs::system::EntityCommands"><code>EntityCommands</code></a>
even if the given <code>Entity</code> cannot be spawned.</p>
<p>See <a href="../world/struct.World.html#method.get_or_spawn" title="method bevy_ecs::world::World::get_or_spawn"><code>World::get_or_spawn</code></a> for more details.</p>
<h5 id="note"><a class="doc-anchor" href="#note">§</a>Note</h5>
<p>Spawning a specific <code>entity</code> value is rarely the right choice. Most apps should favor
<a href="struct.Commands.html#method.spawn" title="method bevy_ecs::system::Commands::spawn"><code>Commands::spawn</code></a>. This method should generally only be used for sharing entities across
apps, and only when they have a scheme worked out to share an ID space (which doesnt happen
by default).</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.spawn" class="method"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#395-399">Source</a><h4 class="code-header">pub fn <a href="#method.spawn" class="fn">spawn</a>&lt;T: <a class="trait" href="../bundle/trait.Bundle.html" title="trait bevy_ecs::bundle::Bundle">Bundle</a>&gt;(&amp;mut self, bundle: T) -&gt; <a class="struct" href="struct.EntityCommands.html" title="struct bevy_ecs::system::EntityCommands">EntityCommands</a>&lt;'_&gt;</h4></section></summary><div class="docblock"><p>Pushes a <a href="../world/trait.Command.html" title="trait bevy_ecs::world::Command"><code>Command</code></a> to the queue for creating a new entity with the given <a href="../bundle/trait.Bundle.html" title="trait bevy_ecs::bundle::Bundle"><code>Bundle</code></a>s components,
and returns its corresponding <a href="struct.EntityCommands.html" title="struct bevy_ecs::system::EntityCommands"><code>EntityCommands</code></a>.</p>
<p>In case multiple bundles of the same <a href="../bundle/trait.Bundle.html" title="trait bevy_ecs::bundle::Bundle"><code>Bundle</code></a> type need to be spawned,
<a href="struct.Commands.html#method.spawn_batch" title="method bevy_ecs::system::Commands::spawn_batch"><code>spawn_batch</code></a> should be used for better performance.</p>
<h5 id="example-1"><a class="doc-anchor" href="#example-1">§</a>Example</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bevy_ecs::prelude::<span class="kw-2">*</span>;
<span class="attr">#[derive(Component)]
</span><span class="kw">struct </span>Component1;
<span class="attr">#[derive(Component)]
</span><span class="kw">struct </span>Component2;
<span class="attr">#[derive(Component)]
</span><span class="kw">struct </span>Label(<span class="kw-2">&amp;</span><span class="lifetime">'static </span>str);
<span class="attr">#[derive(Component)]
</span><span class="kw">struct </span>Strength(u32);
<span class="attr">#[derive(Component)]
</span><span class="kw">struct </span>Agility(u32);
<span class="attr">#[derive(Bundle)]
</span><span class="kw">struct </span>ExampleBundle {
a: Component1,
b: Component2,
}
<span class="kw">fn </span>example_system(<span class="kw-2">mut </span>commands: Commands) {
<span class="comment">// Create a new entity with a single component.
</span>commands.spawn(Component1);
<span class="comment">// Create a new entity with a component bundle.
</span>commands.spawn(ExampleBundle {
a: Component1,
b: Component2,
});
commands
<span class="comment">// Create a new entity with two components using a "tuple bundle".
</span>.spawn((Component1, Component2))
<span class="comment">// `spawn returns a builder, so you can insert more bundles like this:
</span>.insert((Strength(<span class="number">1</span>), Agility(<span class="number">2</span>)))
<span class="comment">// or insert single components like this:
</span>.insert(Label(<span class="string">"hello world"</span>));
}</code></pre></div>
<h5 id="see-also-1"><a class="doc-anchor" href="#see-also-1">§</a>See also</h5>
<ul>
<li><a href="struct.Commands.html#method.spawn_empty" title="method bevy_ecs::system::Commands::spawn_empty"><code>spawn_empty</code></a> to spawn an entity without any components.</li>
<li><a href="struct.Commands.html#method.spawn_batch" title="method bevy_ecs::system::Commands::spawn_batch"><code>spawn_batch</code></a> to spawn entities with a bundle each.</li>
</ul>
</div></details><details class="toggle method-toggle" open><summary><section id="method.entity" class="method"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#437-451">Source</a><h4 class="code-header">pub fn <a href="#method.entity" class="fn">entity</a>(&amp;mut self, entity: <a class="struct" href="../entity/struct.Entity.html" title="struct bevy_ecs::entity::Entity">Entity</a>) -&gt; <a class="struct" href="struct.EntityCommands.html" title="struct bevy_ecs::system::EntityCommands">EntityCommands</a>&lt;'_&gt;</h4></section></summary><div class="docblock"><p>Returns the <a href="struct.EntityCommands.html" title="struct bevy_ecs::system::EntityCommands"><code>EntityCommands</code></a> for the requested <a href="../entity/struct.Entity.html" title="struct bevy_ecs::entity::Entity"><code>Entity</code></a>.</p>
<h5 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h5>
<p>This method panics if the requested entity does not exist.</p>
<h5 id="example-2"><a class="doc-anchor" href="#example-2">§</a>Example</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bevy_ecs::prelude::<span class="kw-2">*</span>;
<span class="attr">#[derive(Component)]
</span><span class="kw">struct </span>Label(<span class="kw-2">&amp;</span><span class="lifetime">'static </span>str);
<span class="attr">#[derive(Component)]
</span><span class="kw">struct </span>Strength(u32);
<span class="attr">#[derive(Component)]
</span><span class="kw">struct </span>Agility(u32);
<span class="kw">fn </span>example_system(<span class="kw-2">mut </span>commands: Commands) {
<span class="comment">// Create a new, empty entity
</span><span class="kw">let </span>entity = commands.spawn_empty().id();
commands.entity(entity)
<span class="comment">// adds a new component bundle to the entity
</span>.insert((Strength(<span class="number">1</span>), Agility(<span class="number">2</span>)))
<span class="comment">// adds a single component to the entity
</span>.insert(Label(<span class="string">"hello world"</span>));
}</code></pre></div>
<h5 id="see-also-2"><a class="doc-anchor" href="#see-also-2">§</a>See also</h5>
<ul>
<li><a href="struct.Commands.html#method.get_entity" title="method bevy_ecs::system::Commands::get_entity"><code>get_entity</code></a> for the fallible version.</li>
</ul>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_entity" class="method"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#485-490">Source</a><h4 class="code-header">pub fn <a href="#method.get_entity" class="fn">get_entity</a>(&amp;mut self, entity: <a class="struct" href="../entity/struct.Entity.html" title="struct bevy_ecs::entity::Entity">Entity</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.EntityCommands.html" title="struct bevy_ecs::system::EntityCommands">EntityCommands</a>&lt;'_&gt;&gt;</h4></section></summary><div class="docblock"><p>Returns the <a href="struct.EntityCommands.html" title="struct bevy_ecs::system::EntityCommands"><code>EntityCommands</code></a> for the requested <a href="../entity/struct.Entity.html" title="struct bevy_ecs::entity::Entity"><code>Entity</code></a>, if it exists.</p>
<p>Returns <code>None</code> if the entity does not exist.</p>
<p>This method does not guarantee that <code>EntityCommands</code> will be successfully applied,
since another command in the queue may delete the entity before them.</p>
<h5 id="example-3"><a class="doc-anchor" href="#example-3">§</a>Example</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bevy_ecs::prelude::<span class="kw-2">*</span>;
<span class="attr">#[derive(Component)]
</span><span class="kw">struct </span>Label(<span class="kw-2">&amp;</span><span class="lifetime">'static </span>str);
<span class="kw">fn </span>example_system(<span class="kw-2">mut </span>commands: Commands) {
<span class="comment">// Create a new, empty entity
</span><span class="kw">let </span>entity = commands.spawn_empty().id();
<span class="comment">// Get the entity if it still exists, which it will in this case
</span><span class="kw">if let </span><span class="prelude-val">Some</span>(<span class="kw-2">mut </span>entity_commands) = commands.get_entity(entity) {
<span class="comment">// adds a single component to the entity
</span>entity_commands.insert(Label(<span class="string">"hello world"</span>));
}
}</code></pre></div>
<h5 id="see-also-3"><a class="doc-anchor" href="#see-also-3">§</a>See also</h5>
<ul>
<li><a href="struct.Commands.html#method.entity" title="method bevy_ecs::system::Commands::entity"><code>entity</code></a> for the panicking version.</li>
</ul>
</div></details><details class="toggle method-toggle" open><summary><section id="method.spawn_batch" class="method"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#531-537">Source</a><h4 class="code-header">pub fn <a href="#method.spawn_batch" class="fn">spawn_batch</a>&lt;I&gt;(&amp;mut self, bundles_iter: I)<div class="where">where
I: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + 'static,
I::<a class="associatedtype" href="https://doc.rust-lang.org/1.84.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" title="type core::iter::traits::collect::IntoIterator::Item">Item</a>: <a class="trait" href="../bundle/trait.Bundle.html" title="trait bevy_ecs::bundle::Bundle">Bundle</a>,</div></h4></section></summary><div class="docblock"><p>Pushes a <a href="../world/trait.Command.html" title="trait bevy_ecs::world::Command"><code>Command</code></a> to the queue for creating entities with a particular <a href="../bundle/trait.Bundle.html" title="trait bevy_ecs::bundle::Bundle"><code>Bundle</code></a> type.</p>
<p><code>bundles_iter</code> is a type that can be converted into a <a href="../bundle/trait.Bundle.html" title="trait bevy_ecs::bundle::Bundle"><code>Bundle</code></a> iterator
(it can also be a collection).</p>
<p>This method is equivalent to iterating <code>bundles_iter</code>
and calling <a href="struct.Commands.html#method.spawn" title="method bevy_ecs::system::Commands::spawn"><code>spawn</code></a> on each bundle,
but it is faster due to memory pre-allocation.</p>
<h5 id="example-4"><a class="doc-anchor" href="#example-4">§</a>Example</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>commands.spawn_batch(<span class="macro">vec!</span>[
(
Name(<span class="string">"Alice"</span>.to_string()),
Score(<span class="number">0</span>),
),
(
Name(<span class="string">"Bob"</span>.to_string()),
Score(<span class="number">0</span>),
),
]);</code></pre></div>
<h5 id="see-also-4"><a class="doc-anchor" href="#see-also-4">§</a>See also</h5>
<ul>
<li><a href="struct.Commands.html#method.spawn" title="method bevy_ecs::system::Commands::spawn"><code>spawn</code></a> to spawn an entity with a bundle.</li>
<li><a href="struct.Commands.html#method.spawn_empty" title="method bevy_ecs::system::Commands::spawn_empty"><code>spawn_empty</code></a> to spawn an entity without any components.</li>
</ul>
</div></details><details class="toggle method-toggle" open><summary><section id="method.queue" class="method"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#571-584">Source</a><h4 class="code-header">pub fn <a href="#method.queue" class="fn">queue</a>&lt;C: <a class="trait" href="../world/trait.Command.html" title="trait bevy_ecs::world::Command">Command</a>&gt;(&amp;mut self, command: C)</h4></section></summary><div class="docblock"><p>Pushes a generic <a href="../world/trait.Command.html" title="trait bevy_ecs::world::Command"><code>Command</code></a> to the command queue.</p>
<p><code>command</code> can be a built-in command, custom struct that implements <a href="../world/trait.Command.html" title="trait bevy_ecs::world::Command"><code>Command</code></a> or a closure
that takes <a href="../world/struct.World.html" title="struct bevy_ecs::world::World"><code>&amp;mut World</code></a> as an argument.</p>
<h5 id="example-5"><a class="doc-anchor" href="#example-5">§</a>Example</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#[derive(Resource, Default)]
</span><span class="kw">struct </span>Counter(u64);
<span class="kw">struct </span>AddToCounter(u64);
<span class="kw">impl </span>Command <span class="kw">for </span>AddToCounter {
<span class="kw">fn </span>apply(<span class="self">self</span>, world: <span class="kw-2">&amp;mut </span>World) {
<span class="kw">let </span><span class="kw-2">mut </span>counter = world.get_resource_or_insert_with(Counter::default);
counter.<span class="number">0 </span>+= <span class="self">self</span>.<span class="number">0</span>;
}
}
<span class="kw">fn </span>add_three_to_counter_system(<span class="kw-2">mut </span>commands: Commands) {
commands.queue(AddToCounter(<span class="number">3</span>));
}
<span class="kw">fn </span>add_twenty_five_to_counter_system(<span class="kw-2">mut </span>commands: Commands) {
commands.queue(|world: <span class="kw-2">&amp;mut </span>World| {
<span class="kw">let </span><span class="kw-2">mut </span>counter = world.get_resource_or_insert_with(Counter::default);
counter.<span class="number">0 </span>+= <span class="number">25</span>;
});
}</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.insert_or_spawn_batch" class="method"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#608-614">Source</a><h4 class="code-header">pub fn <a href="#method.insert_or_spawn_batch" class="fn">insert_or_spawn_batch</a>&lt;I, B&gt;(&amp;mut self, bundles_iter: I)<div class="where">where
I: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = (<a class="struct" href="../entity/struct.Entity.html" title="struct bevy_ecs::entity::Entity">Entity</a>, B)&gt; + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + 'static,
B: <a class="trait" href="../bundle/trait.Bundle.html" title="trait bevy_ecs::bundle::Bundle">Bundle</a>,</div></h4></section></summary><div class="docblock"><p>Pushes a <a href="../world/trait.Command.html" title="trait bevy_ecs::world::Command"><code>Command</code></a> to the queue for creating entities, if needed,
and for adding a bundle to each entity.</p>
<p><code>bundles_iter</code> is a type that can be converted into an (<a href="../entity/struct.Entity.html" title="struct bevy_ecs::entity::Entity"><code>Entity</code></a>, <a href="../bundle/trait.Bundle.html" title="trait bevy_ecs::bundle::Bundle"><code>Bundle</code></a>) iterator
(it can also be a collection).</p>
<p>When the command is applied,
for each (<code>Entity</code>, <code>Bundle</code>) pair in the given <code>bundles_iter</code>,
the <code>Entity</code> is spawned, if it does not exist already.
Then, the <code>Bundle</code> is added to the entity.</p>
<p>This method is equivalent to iterating <code>bundles_iter</code>,
calling <a href="struct.Commands.html#method.get_or_spawn" title="method bevy_ecs::system::Commands::get_or_spawn"><code>get_or_spawn</code></a> for each bundle,
and passing it to <a href="struct.EntityCommands.html#method.insert" title="method bevy_ecs::system::EntityCommands::insert"><code>insert</code></a>,
but it is faster due to memory pre-allocation.</p>
<h5 id="note-1"><a class="doc-anchor" href="#note-1">§</a>Note</h5>
<p>Spawning a specific <code>entity</code> value is rarely the right choice. Most apps should use <a href="struct.Commands.html#method.spawn_batch" title="method bevy_ecs::system::Commands::spawn_batch"><code>Commands::spawn_batch</code></a>.
This method should generally only be used for sharing entities across apps, and only when they have a scheme
worked out to share an ID space (which doesnt happen by default).</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.insert_batch" class="method"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#635-641">Source</a><h4 class="code-header">pub fn <a href="#method.insert_batch" class="fn">insert_batch</a>&lt;I, B&gt;(&amp;mut self, batch: I)<div class="where">where
I: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = (<a class="struct" href="../entity/struct.Entity.html" title="struct bevy_ecs::entity::Entity">Entity</a>, B)&gt; + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + 'static,
B: <a class="trait" href="../bundle/trait.Bundle.html" title="trait bevy_ecs::bundle::Bundle">Bundle</a>,</div></h4></section></summary><div class="docblock"><p>Pushes a <a href="../world/trait.Command.html" title="trait bevy_ecs::world::Command"><code>Command</code></a> to the queue for adding a <a href="../bundle/trait.Bundle.html" title="trait bevy_ecs::bundle::Bundle"><code>Bundle</code></a> type to a batch of <a href="../entity/struct.Entity.html" title="struct bevy_ecs::entity::Entity"><code>Entities</code></a>.</p>
<p>A batch can be any type that implements <a href="https://doc.rust-lang.org/1.84.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator"><code>IntoIterator</code></a> containing <code>(Entity, Bundle)</code> tuples,
such as a [<code>Vec&lt;(Entity, Bundle)&gt;</code>] or an array <code>[(Entity, Bundle); N]</code>.</p>
<p>When the command is applied, for each <code>(Entity, Bundle)</code> pair in the given batch,
the <code>Bundle</code> is added to the <code>Entity</code>, overwriting any existing components shared by the <code>Bundle</code>.</p>
<p>This method is equivalent to iterating the batch,
calling <a href="struct.Commands.html#method.entity" title="method bevy_ecs::system::Commands::entity"><code>entity</code></a> for each pair,
and passing the bundle to <a href="struct.EntityCommands.html#method.insert" title="method bevy_ecs::system::EntityCommands::insert"><code>insert</code></a>,
but it is faster due to memory pre-allocation.</p>
<h5 id="panics-1"><a class="doc-anchor" href="#panics-1">§</a>Panics</h5>
<p>This command panics if any of the given entities do not exist.</p>
<p>For the non-panicking version, see <a href="struct.Commands.html#method.try_insert_batch" title="method bevy_ecs::system::Commands::try_insert_batch"><code>try_insert_batch</code></a>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.insert_batch_if_new" class="method"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#662-668">Source</a><h4 class="code-header">pub fn <a href="#method.insert_batch_if_new" class="fn">insert_batch_if_new</a>&lt;I, B&gt;(&amp;mut self, batch: I)<div class="where">where
I: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = (<a class="struct" href="../entity/struct.Entity.html" title="struct bevy_ecs::entity::Entity">Entity</a>, B)&gt; + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + 'static,
B: <a class="trait" href="../bundle/trait.Bundle.html" title="trait bevy_ecs::bundle::Bundle">Bundle</a>,</div></h4></section></summary><div class="docblock"><p>Pushes a <a href="../world/trait.Command.html" title="trait bevy_ecs::world::Command"><code>Command</code></a> to the queue for adding a <a href="../bundle/trait.Bundle.html" title="trait bevy_ecs::bundle::Bundle"><code>Bundle</code></a> type to a batch of <a href="../entity/struct.Entity.html" title="struct bevy_ecs::entity::Entity"><code>Entities</code></a>.</p>
<p>A batch can be any type that implements <a href="https://doc.rust-lang.org/1.84.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator"><code>IntoIterator</code></a> containing <code>(Entity, Bundle)</code> tuples,
such as a [<code>Vec&lt;(Entity, Bundle)&gt;</code>] or an array <code>[(Entity, Bundle); N]</code>.</p>
<p>When the command is applied, for each <code>(Entity, Bundle)</code> pair in the given batch,
the <code>Bundle</code> is added to the <code>Entity</code>, except for any components already present on the <code>Entity</code>.</p>
<p>This method is equivalent to iterating the batch,
calling <a href="struct.Commands.html#method.entity" title="method bevy_ecs::system::Commands::entity"><code>entity</code></a> for each pair,
and passing the bundle to <a href="struct.EntityCommands.html#method.insert_if_new" title="method bevy_ecs::system::EntityCommands::insert_if_new"><code>insert_if_new</code></a>,
but it is faster due to memory pre-allocation.</p>
<h5 id="panics-2"><a class="doc-anchor" href="#panics-2">§</a>Panics</h5>
<p>This command panics if any of the given entities do not exist.</p>
<p>For the non-panicking version, see <a href="struct.Commands.html#method.try_insert_batch_if_new" title="method bevy_ecs::system::Commands::try_insert_batch_if_new"><code>try_insert_batch_if_new</code></a>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.try_insert_batch" class="method"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#687-693">Source</a><h4 class="code-header">pub fn <a href="#method.try_insert_batch" class="fn">try_insert_batch</a>&lt;I, B&gt;(&amp;mut self, batch: I)<div class="where">where
I: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = (<a class="struct" href="../entity/struct.Entity.html" title="struct bevy_ecs::entity::Entity">Entity</a>, B)&gt; + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + 'static,
B: <a class="trait" href="../bundle/trait.Bundle.html" title="trait bevy_ecs::bundle::Bundle">Bundle</a>,</div></h4></section></summary><div class="docblock"><p>Pushes a <a href="../world/trait.Command.html" title="trait bevy_ecs::world::Command"><code>Command</code></a> to the queue for adding a <a href="../bundle/trait.Bundle.html" title="trait bevy_ecs::bundle::Bundle"><code>Bundle</code></a> type to a batch of <a href="../entity/struct.Entity.html" title="struct bevy_ecs::entity::Entity"><code>Entities</code></a>.</p>
<p>A batch can be any type that implements <a href="https://doc.rust-lang.org/1.84.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator"><code>IntoIterator</code></a> containing <code>(Entity, Bundle)</code> tuples,
such as a [<code>Vec&lt;(Entity, Bundle)&gt;</code>] or an array <code>[(Entity, Bundle); N]</code>.</p>
<p>When the command is applied, for each <code>(Entity, Bundle)</code> pair in the given batch,
the <code>Bundle</code> is added to the <code>Entity</code>, overwriting any existing components shared by the <code>Bundle</code>.</p>
<p>This method is equivalent to iterating the batch,
calling <a href="struct.Commands.html#method.get_entity" title="method bevy_ecs::system::Commands::get_entity"><code>get_entity</code></a> for each pair,
and passing the bundle to <a href="struct.EntityCommands.html#method.insert" title="method bevy_ecs::system::EntityCommands::insert"><code>insert</code></a>,
but it is faster due to memory pre-allocation.</p>
<p>This command silently fails by ignoring any entities that do not exist.</p>
<p>For the panicking version, see <a href="struct.Commands.html#method.insert_batch" title="method bevy_ecs::system::Commands::insert_batch"><code>insert_batch</code></a>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.try_insert_batch_if_new" class="method"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#712-718">Source</a><h4 class="code-header">pub fn <a href="#method.try_insert_batch_if_new" class="fn">try_insert_batch_if_new</a>&lt;I, B&gt;(&amp;mut self, batch: I)<div class="where">where
I: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = (<a class="struct" href="../entity/struct.Entity.html" title="struct bevy_ecs::entity::Entity">Entity</a>, B)&gt; + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + 'static,
B: <a class="trait" href="../bundle/trait.Bundle.html" title="trait bevy_ecs::bundle::Bundle">Bundle</a>,</div></h4></section></summary><div class="docblock"><p>Pushes a <a href="../world/trait.Command.html" title="trait bevy_ecs::world::Command"><code>Command</code></a> to the queue for adding a <a href="../bundle/trait.Bundle.html" title="trait bevy_ecs::bundle::Bundle"><code>Bundle</code></a> type to a batch of <a href="../entity/struct.Entity.html" title="struct bevy_ecs::entity::Entity"><code>Entities</code></a>.</p>
<p>A batch can be any type that implements <a href="https://doc.rust-lang.org/1.84.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator"><code>IntoIterator</code></a> containing <code>(Entity, Bundle)</code> tuples,
such as a [<code>Vec&lt;(Entity, Bundle)&gt;</code>] or an array <code>[(Entity, Bundle); N]</code>.</p>
<p>When the command is applied, for each <code>(Entity, Bundle)</code> pair in the given batch,
the <code>Bundle</code> is added to the <code>Entity</code>, except for any components already present on the <code>Entity</code>.</p>
<p>This method is equivalent to iterating the batch,
calling <a href="struct.Commands.html#method.get_entity" title="method bevy_ecs::system::Commands::get_entity"><code>get_entity</code></a> for each pair,
and passing the bundle to <a href="struct.EntityCommands.html#method.insert_if_new" title="method bevy_ecs::system::EntityCommands::insert_if_new"><code>insert_if_new</code></a>,
but it is faster due to memory pre-allocation.</p>
<p>This command silently fails by ignoring any entities that do not exist.</p>
<p>For the panicking version, see <a href="struct.Commands.html#method.insert_batch_if_new" title="method bevy_ecs::system::Commands::insert_batch_if_new"><code>insert_batch_if_new</code></a>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.init_resource" class="method"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#745-747">Source</a><h4 class="code-header">pub fn <a href="#method.init_resource" class="fn">init_resource</a>&lt;R: <a class="trait" href="trait.Resource.html" title="trait bevy_ecs::system::Resource">Resource</a> + <a class="trait" href="../world/trait.FromWorld.html" title="trait bevy_ecs::world::FromWorld">FromWorld</a>&gt;(&amp;mut self)</h4></section></summary><div class="docblock"><p>Pushes a <a href="../world/trait.Command.html" title="trait bevy_ecs::world::Command"><code>Command</code></a> to the queue for inserting a <a href="trait.Resource.html" title="trait bevy_ecs::system::Resource"><code>Resource</code></a> in the <a href="../world/struct.World.html" title="struct bevy_ecs::world::World"><code>World</code></a> with an inferred value.</p>
<p>The inferred value is determined by the <a href="../world/trait.FromWorld.html" title="trait bevy_ecs::world::FromWorld"><code>FromWorld</code></a> trait of the resource.
When the command is applied,
if the resource already exists, nothing happens.</p>
<p>See <a href="../world/struct.World.html#method.init_resource" title="method bevy_ecs::world::World::init_resource"><code>World::init_resource</code></a> for more details.</p>
<h5 id="example-6"><a class="doc-anchor" href="#example-6">§</a>Example</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>commands.init_resource::&lt;Scoreboard&gt;();</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.insert_resource" class="method"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#775-777">Source</a><h4 class="code-header">pub fn <a href="#method.insert_resource" class="fn">insert_resource</a>&lt;R: <a class="trait" href="trait.Resource.html" title="trait bevy_ecs::system::Resource">Resource</a>&gt;(&amp;mut self, resource: R)</h4></section></summary><div class="docblock"><p>Pushes a <a href="../world/trait.Command.html" title="trait bevy_ecs::world::Command"><code>Command</code></a> to the queue for inserting a <a href="trait.Resource.html" title="trait bevy_ecs::system::Resource"><code>Resource</code></a> in the <a href="../world/struct.World.html" title="struct bevy_ecs::world::World"><code>World</code></a> with a specific value.</p>
<p>This will overwrite any previous value of the same resource type.</p>
<p>See <a href="../world/struct.World.html#method.insert_resource" title="method bevy_ecs::world::World::insert_resource"><code>World::insert_resource</code></a> for more details.</p>
<h5 id="example-7"><a class="doc-anchor" href="#example-7">§</a>Example</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>commands.insert_resource(Scoreboard {
current_score: <span class="number">0</span>,
high_score: <span class="number">0</span>,
});</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.remove_resource" class="method"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#799-801">Source</a><h4 class="code-header">pub fn <a href="#method.remove_resource" class="fn">remove_resource</a>&lt;R: <a class="trait" href="trait.Resource.html" title="trait bevy_ecs::system::Resource">Resource</a>&gt;(&amp;mut self)</h4></section></summary><div class="docblock"><p>Pushes a <a href="../world/trait.Command.html" title="trait bevy_ecs::world::Command"><code>Command</code></a> to the queue for removing a <a href="trait.Resource.html" title="trait bevy_ecs::system::Resource"><code>Resource</code></a> from the <a href="../world/struct.World.html" title="struct bevy_ecs::world::World"><code>World</code></a>.</p>
<p>See <a href="../world/struct.World.html#method.remove_resource" title="method bevy_ecs::world::World::remove_resource"><code>World::remove_resource</code></a> for more details.</p>
<h5 id="example-8"><a class="doc-anchor" href="#example-8">§</a>Example</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>commands.remove_resource::&lt;Scoreboard&gt;();</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.run_system" class="method"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#812-814">Source</a><h4 class="code-header">pub fn <a href="#method.run_system" class="fn">run_system</a>(&amp;mut self, id: <a class="struct" href="struct.SystemId.html" title="struct bevy_ecs::system::SystemId">SystemId</a>)</h4></section></summary><div class="docblock"><p>Runs the system corresponding to the given <a href="struct.SystemId.html" title="struct bevy_ecs::system::SystemId"><code>SystemId</code></a>.
Systems are ran in an exclusive and single threaded way.
Running slow systems can become a bottleneck.</p>
<p>Calls <a href="../world/struct.World.html#method.run_system" title="method bevy_ecs::world::World::run_system"><code>World::run_system</code></a>.</p>
<p>There is no way to get the output of a system when run as a command, because the
execution of the system happens later. To get the output of a system, use
<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> instead of running the system as a command.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.run_system_with_input" class="method"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#825-830">Source</a><h4 class="code-header">pub fn <a href="#method.run_system_with_input" class="fn">run_system_with_input</a>&lt;I&gt;(
&amp;mut self,
id: <a class="struct" href="struct.SystemId.html" title="struct bevy_ecs::system::SystemId">SystemId</a>&lt;I&gt;,
input: I::<a class="associatedtype" href="trait.SystemInput.html#associatedtype.Inner" title="type bevy_ecs::system::SystemInput::Inner">Inner</a>&lt;'static&gt;,
)<div class="where">where
I: <a class="trait" href="trait.SystemInput.html" title="trait bevy_ecs::system::SystemInput">SystemInput</a>&lt;Inner&lt;'static&gt;: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>&gt; + 'static,</div></h4></section></summary><div class="docblock"><p>Runs the system corresponding to the given <a href="struct.SystemId.html" title="struct bevy_ecs::system::SystemId"><code>SystemId</code></a>.
Systems are ran in an exclusive and single threaded way.
Running slow systems can become a bottleneck.</p>
<p>Calls <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>.</p>
<p>There is no way to get the output of a system when run as a command, because the
execution of the system happens later. To get the output of a system, use
<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> instead of running the system as a command.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.register_system" class="method"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#881-892">Source</a><h4 class="code-header">pub fn <a href="#method.register_system" class="fn">register_system</a>&lt;I, O, M&gt;(
&amp;mut self,
system: impl <a class="trait" href="trait.IntoSystem.html" title="trait bevy_ecs::system::IntoSystem">IntoSystem</a>&lt;I, O, M&gt; + 'static,
) -&gt; <a class="struct" href="struct.SystemId.html" title="struct bevy_ecs::system::SystemId">SystemId</a>&lt;I, O&gt;<div class="where">where
I: <a class="trait" href="trait.SystemInput.html" title="trait bevy_ecs::system::SystemInput">SystemInput</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + 'static,
O: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + 'static,</div></h4></section></summary><div class="docblock"><p>Registers a system and returns a <a href="struct.SystemId.html" title="struct bevy_ecs::system::SystemId"><code>SystemId</code></a> so it can later be called by <a href="../world/struct.World.html#method.run_system" title="method bevy_ecs::world::World::run_system"><code>World::run_system</code></a>.</p>
<p>Its possible to register the same systems more than once, theyll be stored separately.</p>
<p>This is different from adding systems to a <a href="../schedule/struct.Schedule.html" title="struct bevy_ecs::schedule::Schedule"><code>Schedule</code></a>,
because the <a href="struct.SystemId.html" title="struct bevy_ecs::system::SystemId"><code>SystemId</code></a> that is returned can be used anywhere in the <a href="../world/struct.World.html" title="struct bevy_ecs::world::World"><code>World</code></a> to run the associated system.
This allows for running systems in a push-based fashion.
Using a <a href="../schedule/struct.Schedule.html" title="struct bevy_ecs::schedule::Schedule"><code>Schedule</code></a> is still preferred for most cases
due to its better performance and ability to run non-conflicting systems simultaneously.</p>
<p>If you want to prevent Commands from registering the same system multiple times, consider using <a href="struct.Local.html" title="struct bevy_ecs::system::Local"><code>Local</code></a></p>
<h5 id="example-9"><a class="doc-anchor" href="#example-9">§</a>Example</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>
<span class="attr">#[derive(Resource)]
</span><span class="kw">struct </span>Counter(i32);
<span class="kw">fn </span>register_system(<span class="kw-2">mut </span>local_system: Local&lt;<span class="prelude-ty">Option</span>&lt;SystemId&gt;&gt;, <span class="kw-2">mut </span>commands: Commands) {
<span class="kw">if let </span><span class="prelude-val">Some</span>(system) = <span class="kw-2">*</span>local_system {
commands.run_system(system);
} <span class="kw">else </span>{
<span class="kw-2">*</span>local_system = <span class="prelude-val">Some</span>(commands.register_system(increment_counter));
}
}
<span class="kw">fn </span>increment_counter(<span class="kw-2">mut </span>value: ResMut&lt;Counter&gt;) {
value.<span class="number">0 </span>+= <span class="number">1</span>;
}
</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.unregister_system" class="method"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#897-903">Source</a><h4 class="code-header">pub fn <a href="#method.unregister_system" class="fn">unregister_system</a>&lt;I, O&gt;(&amp;mut self, system_id: <a class="struct" href="struct.SystemId.html" title="struct bevy_ecs::system::SystemId">SystemId</a>&lt;I, O&gt;)<div class="where">where
I: <a class="trait" href="trait.SystemInput.html" title="trait bevy_ecs::system::SystemInput">SystemInput</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + 'static,
O: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + 'static,</div></h4></section></summary><div class="docblock"><p>Removes a system previously registered with <a href="struct.Commands.html#method.register_system" title="method bevy_ecs::system::Commands::register_system"><code>Commands::register_system</code></a> or <a href="../world/struct.World.html#method.register_system" title="method bevy_ecs::world::World::register_system"><code>World::register_system</code></a>.</p>
<p>See <a href="../world/struct.World.html#method.unregister_system" title="method bevy_ecs::world::World::unregister_system"><code>World::unregister_system</code></a> for more information.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.run_system_cached" class="method"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#909-914">Source</a><h4 class="code-header">pub fn <a href="#method.run_system_cached" class="fn">run_system_cached</a>&lt;M: 'static, S: <a class="trait" href="trait.IntoSystem.html" title="trait bevy_ecs::system::IntoSystem">IntoSystem</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.unit.html">()</a>, <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.unit.html">()</a>, M&gt; + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + 'static&gt;(
&amp;mut self,
system: S,
)</h4></section></summary><div class="docblock"><p>Similar to <a href="struct.Commands.html#method.run_system" title="method bevy_ecs::system::Commands::run_system"><code>Self::run_system</code></a>, but caching the <a href="struct.SystemId.html" title="struct bevy_ecs::system::SystemId"><code>SystemId</code></a> in a
<a href="struct.CachedSystemId.html" title="struct bevy_ecs::system::CachedSystemId"><code>CachedSystemId</code></a> resource.</p>
<p>See <a href="../world/struct.World.html#method.register_system_cached" title="method bevy_ecs::world::World::register_system_cached"><code>World::register_system_cached</code></a> for more information.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.run_system_cached_with" class="method"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#920-927">Source</a><h4 class="code-header">pub fn <a href="#method.run_system_cached_with" class="fn">run_system_cached_with</a>&lt;I, M, S&gt;(
&amp;mut self,
system: S,
input: I::<a class="associatedtype" href="trait.SystemInput.html#associatedtype.Inner" title="type bevy_ecs::system::SystemInput::Inner">Inner</a>&lt;'static&gt;,
)<div class="where">where
I: <a class="trait" href="trait.SystemInput.html" title="trait bevy_ecs::system::SystemInput">SystemInput</a>&lt;Inner&lt;'static&gt;: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>&gt; + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + 'static,
M: 'static,
S: <a class="trait" href="trait.IntoSystem.html" title="trait bevy_ecs::system::IntoSystem">IntoSystem</a>&lt;I, <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.unit.html">()</a>, M&gt; + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + 'static,</div></h4></section></summary><div class="docblock"><p>Similar to <a href="struct.Commands.html#method.run_system_with_input" title="method bevy_ecs::system::Commands::run_system_with_input"><code>Self::run_system_with_input</code></a>, but caching the <a href="struct.SystemId.html" title="struct bevy_ecs::system::SystemId"><code>SystemId</code></a> in a
<a href="struct.CachedSystemId.html" title="struct bevy_ecs::system::CachedSystemId"><code>CachedSystemId</code></a> resource.</p>
<p>See <a href="../world/struct.World.html#method.register_system_cached" title="method bevy_ecs::world::World::register_system_cached"><code>World::register_system_cached</code></a> for more information.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.trigger" class="method"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#933-935">Source</a><h4 class="code-header">pub fn <a href="#method.trigger" class="fn">trigger</a>(&amp;mut self, event: impl <a class="trait" href="../event/trait.Event.html" title="trait bevy_ecs::event::Event">Event</a>)</h4></section></summary><div class="docblock"><p>Sends a “global” <a href="../observer/struct.Trigger.html" title="struct bevy_ecs::observer::Trigger"><code>Trigger</code></a> without any targets. This will run any <a href="../observer/struct.Observer.html" title="struct bevy_ecs::observer::Observer"><code>Observer</code></a> of the <code>event</code> that
isnt scoped to specific targets.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.trigger_targets" class="method"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#941-947">Source</a><h4 class="code-header">pub fn <a href="#method.trigger_targets" class="fn">trigger_targets</a>(
&amp;mut self,
event: impl <a class="trait" href="../event/trait.Event.html" title="trait bevy_ecs::event::Event">Event</a>,
targets: impl <a class="trait" href="../observer/trait.TriggerTargets.html" title="trait bevy_ecs::observer::TriggerTargets">TriggerTargets</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + 'static,
)</h4></section></summary><div class="docblock"><p>Sends a <a href="../observer/struct.Trigger.html" title="struct bevy_ecs::observer::Trigger"><code>Trigger</code></a> for the given targets. This will run any <a href="../observer/struct.Observer.html" title="struct bevy_ecs::observer::Observer"><code>Observer</code></a> of the <code>event</code> that
watches those targets.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.add_observer" class="method"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#955-960">Source</a><h4 class="code-header">pub fn <a href="#method.add_observer" class="fn">add_observer</a>&lt;E: <a class="trait" href="../event/trait.Event.html" title="trait bevy_ecs::event::Event">Event</a>, B: <a class="trait" href="../bundle/trait.Bundle.html" title="trait bevy_ecs::bundle::Bundle">Bundle</a>, M&gt;(
&amp;mut self,
observer: impl <a class="trait" href="trait.IntoObserverSystem.html" title="trait bevy_ecs::system::IntoObserverSystem">IntoObserverSystem</a>&lt;E, B, M&gt;,
) -&gt; <a class="struct" href="struct.EntityCommands.html" title="struct bevy_ecs::system::EntityCommands">EntityCommands</a>&lt;'_&gt;</h4></section></summary><div class="docblock"><p>Spawns an <a href="../observer/struct.Observer.html" title="struct bevy_ecs::observer::Observer"><code>Observer</code></a> and returns the <a href="struct.EntityCommands.html" title="struct bevy_ecs::system::EntityCommands"><code>EntityCommands</code></a> associated
with the entity that stores the observer.</p>
<p><strong>Calling <a href="struct.EntityCommands.html#method.observe" title="method bevy_ecs::system::EntityCommands::observe"><code>observe</code></a> on the returned
<a href="struct.EntityCommands.html" title="struct bevy_ecs::system::EntityCommands"><code>EntityCommands</code></a> will observe the observer itself, which you very
likely do not want.</strong></p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.send_event" class="method"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#972-975">Source</a><h4 class="code-header">pub fn <a href="#method.send_event" class="fn">send_event</a>&lt;E: <a class="trait" href="../event/trait.Event.html" title="trait bevy_ecs::event::Event">Event</a>&gt;(&amp;mut self, event: E) -&gt; &amp;mut Self</h4></section></summary><div class="docblock"><p>Sends an arbitrary <a href="../event/trait.Event.html" title="trait bevy_ecs::event::Event"><code>Event</code></a>.</p>
<p>This is a convenience method for sending events without requiring an <a href="../event/struct.EventWriter.html" title="struct bevy_ecs::event::EventWriter"><code>EventWriter</code></a>.</p>
<h6 id="performance"><a class="doc-anchor" href="#performance">§</a>Performance</h6>
<p>Since this is a command, exclusive world access is used, which means that it will not profit from
system-level parallelism on supported platforms.
If these events are performance-critical or very frequently
sent, consider using a typed <a href="../event/struct.EventWriter.html" title="struct bevy_ecs::event::EventWriter"><code>EventWriter</code></a> instead.</p>
</div></details></div></details></div><h2 id="trait-implementations" class="section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-SystemParam-for-Commands%3C'_,+'_%3E" class="impl"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#96-178">Source</a><a href="#impl-SystemParam-for-Commands%3C'_,+'_%3E" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.SystemParam.html" title="trait bevy_ecs::system::SystemParam">SystemParam</a> for <a class="struct" href="struct.Commands.html" title="struct bevy_ecs::system::Commands">Commands</a>&lt;'_, '_&gt;</h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.State" class="associatedtype trait-impl"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#97">Source</a><a href="#associatedtype.State" class="anchor">§</a><h4 class="code-header">type <a href="trait.SystemParam.html#associatedtype.State" class="associatedtype">State</a> = FetchState</h4></section></summary><div class='docblock'>Used to store data which persists across invocations of a system.</div></details><details class="toggle" open><summary><section id="associatedtype.Item" class="associatedtype trait-impl"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#99">Source</a><a href="#associatedtype.Item" class="anchor">§</a><h4 class="code-header">type <a href="trait.SystemParam.html#associatedtype.Item" class="associatedtype">Item</a>&lt;'w, 's&gt; = <a class="struct" href="struct.Commands.html" title="struct bevy_ecs::system::Commands">Commands</a>&lt;'w, 's&gt;</h4></section></summary><div class='docblock'>The item type returned when constructing this system param.
The value of this associated type should be <code>Self</code>, instantiated with new lifetimes. <a href="trait.SystemParam.html#associatedtype.Item">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.init_state" class="method trait-impl"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#101-111">Source</a><a href="#method.init_state" class="anchor">§</a><h4 class="code-header">fn <a href="trait.SystemParam.html#tymethod.init_state" class="fn">init_state</a>(world: &amp;mut <a class="struct" href="../world/struct.World.html" title="struct bevy_ecs::world::World">World</a>, system_meta: &amp;mut <a class="struct" href="struct.SystemMeta.html" title="struct bevy_ecs::system::SystemMeta">SystemMeta</a>) -&gt; Self::<a class="associatedtype" href="trait.SystemParam.html#associatedtype.State" title="type bevy_ecs::system::SystemParam::State">State</a></h4></section></summary><div class='docblock'>Registers any <a href="../world/struct.World.html" title="struct bevy_ecs::world::World"><code>World</code></a> access used by this <a href="trait.SystemParam.html" title="trait bevy_ecs::system::SystemParam"><code>SystemParam</code></a>
and creates a new instance of this params <a href="trait.SystemParam.html#associatedtype.State" title="associated type bevy_ecs::system::SystemParam::State"><code>State</code></a>.</div></details><details class="toggle method-toggle" open><summary><section id="method.new_archetype" class="method trait-impl"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#113-126">Source</a><a href="#method.new_archetype" class="anchor">§</a><h4 class="code-header">unsafe fn <a href="trait.SystemParam.html#method.new_archetype" class="fn">new_archetype</a>(
state: &amp;mut Self::<a class="associatedtype" href="trait.SystemParam.html#associatedtype.State" title="type bevy_ecs::system::SystemParam::State">State</a>,
archetype: &amp;<a class="struct" href="../archetype/struct.Archetype.html" title="struct bevy_ecs::archetype::Archetype">Archetype</a>,
system_meta: &amp;mut <a class="struct" href="struct.SystemMeta.html" title="struct bevy_ecs::system::SystemMeta">SystemMeta</a>,
)</h4></section></summary><div class='docblock'>For the specified <a href="../archetype/struct.Archetype.html" title="struct bevy_ecs::archetype::Archetype"><code>Archetype</code></a>, registers the components accessed by this <a href="trait.SystemParam.html" title="trait bevy_ecs::system::SystemParam"><code>SystemParam</code></a> (if applicable).a <a href="trait.SystemParam.html#method.new_archetype">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.apply" class="method trait-impl"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#128-138">Source</a><a href="#method.apply" class="anchor">§</a><h4 class="code-header">fn <a href="trait.SystemParam.html#method.apply" class="fn">apply</a>(state: &amp;mut Self::<a class="associatedtype" href="trait.SystemParam.html#associatedtype.State" title="type bevy_ecs::system::SystemParam::State">State</a>, system_meta: &amp;<a class="struct" href="struct.SystemMeta.html" title="struct bevy_ecs::system::SystemMeta">SystemMeta</a>, world: &amp;mut <a class="struct" href="../world/struct.World.html" title="struct bevy_ecs::world::World">World</a>)</h4></section></summary><div class='docblock'>Applies any deferred mutations stored in this <a href="trait.SystemParam.html" title="trait bevy_ecs::system::SystemParam"><code>SystemParam</code></a>s state.
This is used to apply <a href="struct.Commands.html" title="struct bevy_ecs::system::Commands"><code>Commands</code></a> during <a href="../schedule/fn.apply_deferred.html" title="fn bevy_ecs::schedule::apply_deferred"><code>apply_deferred</code></a>.</div></details><details class="toggle method-toggle" open><summary><section id="method.queue-1" class="method trait-impl"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#140-150">Source</a><a href="#method.queue-1" class="anchor">§</a><h4 class="code-header">fn <a href="trait.SystemParam.html#method.queue" class="fn">queue</a>(
state: &amp;mut Self::<a class="associatedtype" href="trait.SystemParam.html#associatedtype.State" title="type bevy_ecs::system::SystemParam::State">State</a>,
system_meta: &amp;<a class="struct" href="struct.SystemMeta.html" title="struct bevy_ecs::system::SystemMeta">SystemMeta</a>,
world: <a class="struct" href="../world/struct.DeferredWorld.html" title="struct bevy_ecs::world::DeferredWorld">DeferredWorld</a>&lt;'_&gt;,
)</h4></section></summary><div class='docblock'>Queues any deferred mutations to be applied at the next <a href="../schedule/fn.apply_deferred.html" title="fn bevy_ecs::schedule::apply_deferred"><code>apply_deferred</code></a>.</div></details><details class="toggle method-toggle" open><summary><section id="method.validate_param" class="method trait-impl"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#153-163">Source</a><a href="#method.validate_param" class="anchor">§</a><h4 class="code-header">unsafe fn <a href="trait.SystemParam.html#method.validate_param" class="fn">validate_param</a>(
state: &amp;Self::<a class="associatedtype" href="trait.SystemParam.html#associatedtype.State" title="type bevy_ecs::system::SystemParam::State">State</a>,
system_meta: &amp;<a class="struct" href="struct.SystemMeta.html" title="struct bevy_ecs::system::SystemMeta">SystemMeta</a>,
world: <a class="struct" href="../world/unsafe_world_cell/struct.UnsafeWorldCell.html" title="struct bevy_ecs::world::unsafe_world_cell::UnsafeWorldCell">UnsafeWorldCell</a>&lt;'_&gt;,
) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Validates that the param can be acquired by the <a href="trait.SystemParam.html#tymethod.get_param" title="associated function bevy_ecs::system::SystemParam::get_param"><code>get_param</code></a>.
Built-in executors use this to prevent systems with invalid params from running.
For nested <a href="trait.SystemParam.html" title="trait bevy_ecs::system::SystemParam"><code>SystemParam</code></a>s validation will fail if any
delegated validation fails. <a href="trait.SystemParam.html#method.validate_param">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.get_param" class="method trait-impl"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#166-177">Source</a><a href="#method.get_param" class="anchor">§</a><h4 class="code-header">unsafe fn <a href="trait.SystemParam.html#tymethod.get_param" class="fn">get_param</a>&lt;'w, 's&gt;(
state: &amp;'s mut Self::<a class="associatedtype" href="trait.SystemParam.html#associatedtype.State" title="type bevy_ecs::system::SystemParam::State">State</a>,
system_meta: &amp;<a class="struct" href="struct.SystemMeta.html" title="struct bevy_ecs::system::SystemMeta">SystemMeta</a>,
world: <a class="struct" href="../world/unsafe_world_cell/struct.UnsafeWorldCell.html" title="struct bevy_ecs::world::unsafe_world_cell::UnsafeWorldCell">UnsafeWorldCell</a>&lt;'w&gt;,
change_tick: <a class="struct" href="../component/struct.Tick.html" title="struct bevy_ecs::component::Tick">Tick</a>,
) -&gt; Self::<a class="associatedtype" href="trait.SystemParam.html#associatedtype.Item" title="type bevy_ecs::system::SystemParam::Item">Item</a>&lt;'w, 's&gt;</h4></section></summary><div class='docblock'>Creates a parameter to be passed into a <a href="trait.SystemParamFunction.html" title="trait bevy_ecs::system::SystemParamFunction"><code>SystemParamFunction</code></a>. <a href="trait.SystemParam.html#tymethod.get_param">Read more</a></div></details></div></details><section id="impl-ReadOnlySystemParam-for-Commands%3C'w,+'s%3E" class="impl"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#180-185">Source</a><a href="#impl-ReadOnlySystemParam-for-Commands%3C'w,+'s%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'w, 's&gt; <a class="trait" href="trait.ReadOnlySystemParam.html" title="trait bevy_ecs::system::ReadOnlySystemParam">ReadOnlySystemParam</a> for <a class="struct" href="struct.Commands.html" title="struct bevy_ecs::system::Commands">Commands</a>&lt;'w, 's&gt;<div class="where">where
<a class="struct" href="struct.Deferred.html" title="struct bevy_ecs::system::Deferred">Deferred</a>&lt;'s, <a class="struct" href="../world/struct.CommandQueue.html" title="struct bevy_ecs::world::CommandQueue">CommandQueue</a>&gt;: <a class="trait" href="trait.ReadOnlySystemParam.html" title="trait bevy_ecs::system::ReadOnlySystemParam">ReadOnlySystemParam</a>,
&amp;'w <a class="struct" href="../entity/struct.Entities.html" title="struct bevy_ecs::entity::Entities">Entities</a>: <a class="trait" href="trait.ReadOnlySystemParam.html" title="trait bevy_ecs::system::ReadOnlySystemParam">ReadOnlySystemParam</a>,</div></h3></section><section id="impl-Send-for-Commands%3C'_,+'_%3E" class="impl"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#84">Source</a><a href="#impl-Send-for-Commands%3C'_,+'_%3E" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.Commands.html" title="struct bevy_ecs::system::Commands">Commands</a>&lt;'_, '_&gt;</h3></section><section id="impl-Sync-for-Commands%3C'_,+'_%3E" class="impl"><a class="src rightside" href="../../src/bevy_ecs/system/commands/mod.rs.html#87">Source</a><a href="#impl-Sync-for-Commands%3C'_,+'_%3E" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.Commands.html" title="struct bevy_ecs::system::Commands">Commands</a>&lt;'_, '_&gt;</h3></section></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-Freeze-for-Commands%3C'w,+'s%3E" class="impl"><a href="#impl-Freeze-for-Commands%3C'w,+'s%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'w, 's&gt; <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Freeze.html" title="trait core::marker::Freeze">Freeze</a> for <a class="struct" href="struct.Commands.html" title="struct bevy_ecs::system::Commands">Commands</a>&lt;'w, 's&gt;</h3></section><section id="impl-RefUnwindSafe-for-Commands%3C'w,+'s%3E" class="impl"><a href="#impl-RefUnwindSafe-for-Commands%3C'w,+'s%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'w, 's&gt; <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.Commands.html" title="struct bevy_ecs::system::Commands">Commands</a>&lt;'w, 's&gt;</h3></section><section id="impl-Unpin-for-Commands%3C'w,+'s%3E" class="impl"><a href="#impl-Unpin-for-Commands%3C'w,+'s%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'w, 's&gt; <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.Commands.html" title="struct bevy_ecs::system::Commands">Commands</a>&lt;'w, 's&gt;</h3></section><section id="impl-UnwindSafe-for-Commands%3C'w,+'s%3E" class="impl"><a href="#impl-UnwindSafe-for-Commands%3C'w,+'s%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'w, 's&gt; !<a class="trait" href="https://doc.rust-lang.org/1.84.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.Commands.html" title="struct bevy_ecs::system::Commands">Commands</a>&lt;'w, 's&gt;</h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/any.rs.html#138">Source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/any.rs.html#139">Source</a><a href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/any/trait.Any.html#tymethod.type_id" class="fn">type_id</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.84.0/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/1.84.0/core/any/trait.Any.html#tymethod.type_id">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/borrow.rs.html#209">Source</a><a href="#impl-Borrow%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;T&gt; for T<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/borrow.rs.html#211">Source</a><a href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.reference.html">&amp;T</a></h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.84.0/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/borrow.rs.html#217">Source</a><a href="#impl-BorrowMut%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a>&lt;T&gt; for T<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/borrow.rs.html#218">Source</a><a href="#method.borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fn">borrow_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.reference.html">&amp;mut T</a></h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.84.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Downcast-for-T" class="impl"><a class="src rightside" href="../../src/downcast_rs/lib.rs.html#189">Source</a><a href="#impl-Downcast-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="../../downcast_rs/trait.Downcast.html" title="trait downcast_rs::Downcast">Downcast</a> for T<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into_any" class="method trait-impl"><a class="src rightside" href="../../src/downcast_rs/lib.rs.html#190">Source</a><a href="#method.into_any" class="anchor">§</a><h4 class="code-header">fn <a href="../../downcast_rs/trait.Downcast.html#tymethod.into_any" class="fn">into_any</a>(self: <a class="struct" href="https://doc.rust-lang.org/1.84.0/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;T&gt;) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.84.0/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;dyn <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a>&gt;</h4></section></summary><div class='docblock'>Convert <code>Box&lt;dyn Trait&gt;</code> (where <code>Trait: Downcast</code>) to <code>Box&lt;dyn Any&gt;</code>. <code>Box&lt;dyn Any&gt;</code> can
then be further <code>downcast</code> into <code>Box&lt;ConcreteType&gt;</code> where <code>ConcreteType</code> implements <code>Trait</code>.</div></details><details class="toggle method-toggle" open><summary><section id="method.into_any_rc" class="method trait-impl"><a class="src rightside" href="../../src/downcast_rs/lib.rs.html#191">Source</a><a href="#method.into_any_rc" class="anchor">§</a><h4 class="code-header">fn <a href="../../downcast_rs/trait.Downcast.html#tymethod.into_any_rc" class="fn">into_any_rc</a>(self: <a class="struct" href="https://doc.rust-lang.org/1.84.0/alloc/rc/struct.Rc.html" title="struct alloc::rc::Rc">Rc</a>&lt;T&gt;) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.84.0/alloc/rc/struct.Rc.html" title="struct alloc::rc::Rc">Rc</a>&lt;dyn <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a>&gt;</h4></section></summary><div class='docblock'>Convert <code>Rc&lt;Trait&gt;</code> (where <code>Trait: Downcast</code>) to <code>Rc&lt;Any&gt;</code>. <code>Rc&lt;Any&gt;</code> can then be
further <code>downcast</code> into <code>Rc&lt;ConcreteType&gt;</code> where <code>ConcreteType</code> implements <code>Trait</code>.</div></details><details class="toggle method-toggle" open><summary><section id="method.as_any" class="method trait-impl"><a class="src rightside" href="../../src/downcast_rs/lib.rs.html#192">Source</a><a href="#method.as_any" class="anchor">§</a><h4 class="code-header">fn <a href="../../downcast_rs/trait.Downcast.html#tymethod.as_any" class="fn">as_any</a>(&amp;self) -&gt; &amp;(dyn <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a> + 'static)</h4></section></summary><div class='docblock'>Convert <code>&amp;Trait</code> (where <code>Trait: Downcast</code>) to <code>&amp;Any</code>. This is needed since Rust cannot
generate <code>&amp;Any</code>s vtable from <code>&amp;Trait</code>s.</div></details><details class="toggle method-toggle" open><summary><section id="method.as_any_mut" class="method trait-impl"><a class="src rightside" href="../../src/downcast_rs/lib.rs.html#193">Source</a><a href="#method.as_any_mut" class="anchor">§</a><h4 class="code-header">fn <a href="../../downcast_rs/trait.Downcast.html#tymethod.as_any_mut" class="fn">as_any_mut</a>(&amp;mut self) -&gt; &amp;mut (dyn <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a> + 'static)</h4></section></summary><div class='docblock'>Convert <code>&amp;mut Trait</code> (where <code>Trait: Downcast</code>) to <code>&amp;Any</code>. This is needed since Rust cannot
generate <code>&amp;mut Any</code>s vtable from <code>&amp;mut Trait</code>s.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-DowncastSync-for-T" class="impl"><a class="src rightside" href="../../src/downcast_rs/lib.rs.html#203">Source</a><a href="#impl-DowncastSync-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="../../downcast_rs/trait.DowncastSync.html" title="trait downcast_rs::DowncastSync">DowncastSync</a> for T<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into_any_arc" class="method trait-impl"><a class="src rightside" href="../../src/downcast_rs/lib.rs.html#204">Source</a><a href="#method.into_any_arc" class="anchor">§</a><h4 class="code-header">fn <a href="../../downcast_rs/trait.DowncastSync.html#tymethod.into_any_arc" class="fn">into_any_arc</a>(self: <a class="struct" href="https://doc.rust-lang.org/1.84.0/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;T&gt;) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.84.0/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;dyn <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>&gt;</h4></section></summary><div class='docblock'>Convert <code>Arc&lt;Trait&gt;</code> (where <code>Trait: Downcast</code>) to <code>Arc&lt;Any&gt;</code>. <code>Arc&lt;Any&gt;</code> can then be
further <code>downcast</code> into <code>Arc&lt;ConcreteType&gt;</code> where <code>ConcreteType</code> implements <code>Trait</code>.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/convert/mod.rs.html#765">Source</a><a href="#impl-From%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/convert/mod.rs.html#768">Source</a><a href="#method.from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: T) -&gt; T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Instrument-for-T" class="impl"><a class="src rightside" href="../../src/tracing/instrument.rs.html#325">Source</a><a href="#impl-Instrument-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="../../tracing/instrument/trait.Instrument.html" title="trait tracing::instrument::Instrument">Instrument</a> for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.instrument" class="method trait-impl"><a class="src rightside" href="../../src/tracing/instrument.rs.html#86">Source</a><a href="#method.instrument" class="anchor">§</a><h4 class="code-header">fn <a href="../../tracing/instrument/trait.Instrument.html#method.instrument" class="fn">instrument</a>(self, span: <a class="struct" href="../../tracing/span/struct.Span.html" title="struct tracing::span::Span">Span</a>) -&gt; <a class="struct" href="../../tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a>&lt;Self&gt;</h4></section></summary><div class='docblock'>Instruments this type with the provided <a href="../../tracing/span/struct.Span.html" title="struct tracing::span::Span"><code>Span</code></a>, returning an
<code>Instrumented</code> wrapper. <a href="../../tracing/instrument/trait.Instrument.html#method.instrument">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.in_current_span" class="method trait-impl"><a class="src rightside" href="../../src/tracing/instrument.rs.html#128">Source</a><a href="#method.in_current_span" class="anchor">§</a><h4 class="code-header">fn <a href="../../tracing/instrument/trait.Instrument.html#method.in_current_span" class="fn">in_current_span</a>(self) -&gt; <a class="struct" href="../../tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a>&lt;Self&gt;</h4></section></summary><div class='docblock'>Instruments this type with the <a href="../../tracing/span/struct.Span.html#method.current" title="associated function tracing::span::Span::current">current</a> <a href="../../tracing/span/struct.Span.html" title="struct tracing::span::Span"><code>Span</code></a>, returning an
<code>Instrumented</code> wrapper. <a href="../../tracing/instrument/trait.Instrument.html#method.in_current_span">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/convert/mod.rs.html#748-750">Source</a><a href="#impl-Into%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/convert/mod.rs.html#758">Source</a><a href="#method.into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/convert/trait.Into.html#tymethod.into" class="fn">into</a>(self) -&gt; U</h4></section></summary><div class="docblock"><p>Calls <code>U::from(self)</code>.</p>
<p>That is, this conversion is whatever the implementation of
<code><a href="https://doc.rust-lang.org/1.84.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for U</code> chooses to do.</p>
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/convert/mod.rs.html#805-807">Source</a><a href="#impl-TryFrom%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/convert/mod.rs.html#809">Source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/convert/mod.rs.html#812">Source</a><a href="#method.try_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryFrom.html#tymethod.try_from" class="fn">try_from</a>(value: U) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, &lt;T as <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/convert/mod.rs.html#790-792">Source</a><a href="#impl-TryInto%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/convert/mod.rs.html#794">Source</a><a href="#associatedtype.Error" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = &lt;U as <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/convert/mod.rs.html#797">Source</a><a href="#method.try_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryInto.html#tymethod.try_into" class="fn">try_into</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;U, &lt;U as <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-VZip%3CV%3E-for-T" class="impl"><a class="src rightside" href="../../src/ppv_lite86/types.rs.html#221-223">Source</a><a href="#impl-VZip%3CV%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;V, T&gt; <a class="trait" href="../../ppv_lite86/types/trait.VZip.html" title="trait ppv_lite86::types::VZip">VZip</a>&lt;V&gt; for T<div class="where">where
V: <a class="trait" href="../../ppv_lite86/types/trait.MultiLane.html" title="trait ppv_lite86::types::MultiLane">MultiLane</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><section id="method.vzip" class="method trait-impl"><a class="src rightside" href="../../src/ppv_lite86/types.rs.html#226">Source</a><a href="#method.vzip" class="anchor">§</a><h4 class="code-header">fn <a href="../../ppv_lite86/types/trait.VZip.html#tymethod.vzip" class="fn">vzip</a>(self) -&gt; V</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-WithSubscriber-for-T" class="impl"><a class="src rightside" href="../../src/tracing/instrument.rs.html#393">Source</a><a href="#impl-WithSubscriber-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="../../tracing/instrument/trait.WithSubscriber.html" title="trait tracing::instrument::WithSubscriber">WithSubscriber</a> for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.with_subscriber" class="method trait-impl"><a class="src rightside" href="../../src/tracing/instrument.rs.html#176-178">Source</a><a href="#method.with_subscriber" class="anchor">§</a><h4 class="code-header">fn <a href="../../tracing/instrument/trait.WithSubscriber.html#method.with_subscriber" class="fn">with_subscriber</a>&lt;S&gt;(self, subscriber: S) -&gt; <a class="struct" href="../../tracing/instrument/struct.WithDispatch.html" title="struct tracing::instrument::WithDispatch">WithDispatch</a>&lt;Self&gt;<div class="where">where
S: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="../../tracing_core/dispatcher/struct.Dispatch.html" title="struct tracing_core::dispatcher::Dispatch">Dispatch</a>&gt;,</div></h4></section></summary><div class='docblock'>Attaches the provided <a href="../../tracing_core/subscriber/trait.Subscriber.html" title="trait tracing_core::subscriber::Subscriber"><code>Subscriber</code></a> to this type, returning a
<a href="../../tracing/instrument/struct.WithDispatch.html" title="struct tracing::instrument::WithDispatch"><code>WithDispatch</code></a> wrapper. <a href="../../tracing/instrument/trait.WithSubscriber.html#method.with_subscriber">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.with_current_subscriber" class="method trait-impl"><a class="src rightside" href="../../src/tracing/instrument.rs.html#228">Source</a><a href="#method.with_current_subscriber" class="anchor">§</a><h4 class="code-header">fn <a href="../../tracing/instrument/trait.WithSubscriber.html#method.with_current_subscriber" class="fn">with_current_subscriber</a>(self) -&gt; <a class="struct" href="../../tracing/instrument/struct.WithDispatch.html" title="struct tracing::instrument::WithDispatch">WithDispatch</a>&lt;Self&gt;</h4></section></summary><div class='docblock'>Attaches the current <a href="../../tracing/dispatcher/index.html#setting-the-default-subscriber" title="mod tracing::dispatcher">default</a> <a href="../../tracing_core/subscriber/trait.Subscriber.html" title="trait tracing_core::subscriber::Subscriber"><code>Subscriber</code></a> to this type, returning a
<a href="../../tracing/instrument/struct.WithDispatch.html" title="struct tracing::instrument::WithDispatch"><code>WithDispatch</code></a> wrapper. <a href="../../tracing/instrument/trait.WithSubscriber.html#method.with_current_subscriber">Read more</a></div></details></div></details><section id="impl-ConditionalSend-for-T" class="impl"><a class="src rightside" href="../../src/bevy_utils/lib.rs.html#65">Source</a><a href="#impl-ConditionalSend-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="../../bevy_utils/conditional_send/trait.ConditionalSend.html" title="trait bevy_utils::conditional_send::ConditionalSend">ConditionalSend</a> for T<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>,</div></h3></section></div></section></div></main></body></html>