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

36 lines
11 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="`System` types that do not modify the `World` when run. This is implemented for any systems whose parameters all implement `ReadOnlySystemParam`."><title>ReadOnlySystem 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 trait"><!--[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="#">Read<wbr>Only<wbr>System</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#safety" title="Safety">Safety</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.run_readonly" title="run_readonly">run_readonly</a></li></ul><h3><a href="#implementors">Implementors</a></h3></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>Trait <span class="trait">ReadOnlySystem</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/system.rs.html#181-194">Source</a> </span></div><pre class="rust item-decl"><code>pub unsafe trait ReadOnlySystem: <a class="trait" href="trait.System.html" title="trait bevy_ecs::system::System">System</a> {
// Provided method
fn <a href="#method.run_readonly" class="fn">run_readonly</a>(
&amp;mut self,
input: <a class="type" href="type.SystemIn.html" title="type bevy_ecs::system::SystemIn">SystemIn</a>&lt;'_, Self&gt;,
world: &amp;<a class="struct" href="../world/struct.World.html" title="struct bevy_ecs::world::World">World</a>,
) -&gt; Self::<a class="associatedtype" href="trait.System.html#associatedtype.Out" title="type bevy_ecs::system::System::Out">Out</a> { ... }
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p><a href="trait.System.html" title="trait bevy_ecs::system::System"><code>System</code></a> types that do not modify the <a href="../world/struct.World.html" title="struct bevy_ecs::world::World"><code>World</code></a> when run.
This is implemented for any systems whose parameters all implement <a href="trait.ReadOnlySystemParam.html" title="trait bevy_ecs::system::ReadOnlySystemParam"><code>ReadOnlySystemParam</code></a>.</p>
<p>Note that systems which perform <a href="trait.System.html#tymethod.apply_deferred" title="method bevy_ecs::system::System::apply_deferred">deferred</a> mutations (such as with <a href="struct.Commands.html" title="struct bevy_ecs::system::Commands"><code>Commands</code></a>)
may implement this trait.</p>
<h2 id="safety"><a class="doc-anchor" href="#safety">§</a>Safety</h2>
<p>This must only be implemented for system types which do not mutate the <code>World</code>
when <a href="trait.System.html#tymethod.run_unsafe" title="method bevy_ecs::system::System::run_unsafe"><code>System::run_unsafe</code></a> is called.</p>
</div></details><h2 id="provided-methods" class="section-header">Provided Methods<a href="#provided-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="method.run_readonly" class="method"><a class="src rightside" href="../../src/bevy_ecs/system/system.rs.html#186-193">Source</a><h4 class="code-header">fn <a href="#method.run_readonly" class="fn">run_readonly</a>(
&amp;mut self,
input: <a class="type" href="type.SystemIn.html" title="type bevy_ecs::system::SystemIn">SystemIn</a>&lt;'_, Self&gt;,
world: &amp;<a class="struct" href="../world/struct.World.html" title="struct bevy_ecs::world::World">World</a>,
) -&gt; Self::<a class="associatedtype" href="trait.System.html#associatedtype.Out" title="type bevy_ecs::system::System::Out">Out</a></h4></section></summary><div class="docblock"><p>Runs this system with the given input in the world.</p>
<p>Unlike <a href="trait.System.html#method.run" title="method bevy_ecs::system::System::run"><code>System::run</code></a>, this can be called with a shared reference to the world,
since this system is known not to modify the world.</p>
</div></details></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-ReadOnlySystem-for-PipeSystem%3CA,+B%3E" class="impl"><a class="src rightside" href="../../src/bevy_ecs/system/combinator.rs.html#482-488">Source</a><a href="#impl-ReadOnlySystem-for-PipeSystem%3CA,+B%3E" class="anchor">§</a><h3 class="code-header">impl&lt;A, B&gt; <a class="trait" href="trait.ReadOnlySystem.html" title="trait bevy_ecs::system::ReadOnlySystem">ReadOnlySystem</a> for <a class="struct" href="struct.PipeSystem.html" title="struct bevy_ecs::system::PipeSystem">PipeSystem</a>&lt;A, B&gt;<div class="where">where
A: <a class="trait" href="trait.ReadOnlySystem.html" title="trait bevy_ecs::system::ReadOnlySystem">ReadOnlySystem</a>,
B: <a class="trait" href="trait.ReadOnlySystem.html" title="trait bevy_ecs::system::ReadOnlySystem">ReadOnlySystem</a>,
for&lt;'a&gt; B::<a class="associatedtype" href="trait.System.html#associatedtype.In" title="type bevy_ecs::system::System::In">In</a>: <a class="trait" href="trait.SystemInput.html" title="trait bevy_ecs::system::SystemInput">SystemInput</a>&lt;Inner&lt;'a&gt; = A::<a class="associatedtype" href="trait.System.html#associatedtype.Out" title="type bevy_ecs::system::System::Out">Out</a>&gt;,</div></h3></section><div class="docblock"><p>SAFETY: Both systems are read-only, so any system created by piping them will only read from the world.</p>
</div><section id="impl-ReadOnlySystem-for-CombinatorSystem%3CFunc,+A,+B%3E" class="impl"><a class="src rightside" href="../../src/bevy_ecs/system/combinator.rs.html#259-265">Source</a><a href="#impl-ReadOnlySystem-for-CombinatorSystem%3CFunc,+A,+B%3E" class="anchor">§</a><h3 class="code-header">impl&lt;Func, A, B&gt; <a class="trait" href="trait.ReadOnlySystem.html" title="trait bevy_ecs::system::ReadOnlySystem">ReadOnlySystem</a> for <a class="struct" href="struct.CombinatorSystem.html" title="struct bevy_ecs::system::CombinatorSystem">CombinatorSystem</a>&lt;Func, A, B&gt;<div class="where">where
Func: <a class="trait" href="trait.Combine.html" title="trait bevy_ecs::system::Combine">Combine</a>&lt;A, B&gt; + 'static,
A: <a class="trait" href="trait.ReadOnlySystem.html" title="trait bevy_ecs::system::ReadOnlySystem">ReadOnlySystem</a>,
B: <a class="trait" href="trait.ReadOnlySystem.html" title="trait bevy_ecs::system::ReadOnlySystem">ReadOnlySystem</a>,</div></h3></section><div class="docblock"><p>SAFETY: Both systems are read-only, so any system created by combining them will only read from the world.</p>
</div><section id="impl-ReadOnlySystem-for-AdapterSystem%3CFunc,+S%3E" class="impl"><a class="src rightside" href="../../src/bevy_ecs/system/adapter_system.rs.html#214-219">Source</a><a href="#impl-ReadOnlySystem-for-AdapterSystem%3CFunc,+S%3E" class="anchor">§</a><h3 class="code-header">impl&lt;Func, S&gt; <a class="trait" href="trait.ReadOnlySystem.html" title="trait bevy_ecs::system::ReadOnlySystem">ReadOnlySystem</a> for <a class="struct" href="struct.AdapterSystem.html" title="struct bevy_ecs::system::AdapterSystem">AdapterSystem</a>&lt;Func, S&gt;<div class="where">where
Func: <a class="trait" href="trait.Adapt.html" title="trait bevy_ecs::system::Adapt">Adapt</a>&lt;S&gt;,
S: <a class="trait" href="trait.ReadOnlySystem.html" title="trait bevy_ecs::system::ReadOnlySystem">ReadOnlySystem</a>,</div></h3></section><section id="impl-ReadOnlySystem-for-FunctionSystem%3CMarker,+F%3E" class="impl"><a class="src rightside" href="../../src/bevy_ecs/system/function_system.rs.html#884-890">Source</a><a href="#impl-ReadOnlySystem-for-FunctionSystem%3CMarker,+F%3E" class="anchor">§</a><h3 class="code-header">impl&lt;Marker, F&gt; <a class="trait" href="trait.ReadOnlySystem.html" title="trait bevy_ecs::system::ReadOnlySystem">ReadOnlySystem</a> for <a class="struct" href="struct.FunctionSystem.html" title="struct bevy_ecs::system::FunctionSystem">FunctionSystem</a>&lt;Marker, F&gt;<div class="where">where
Marker: 'static,
F: <a class="trait" href="trait.SystemParamFunction.html" title="trait bevy_ecs::system::SystemParamFunction">SystemParamFunction</a>&lt;Marker&gt;,
F::<a class="associatedtype" href="trait.SystemParamFunction.html#associatedtype.Param" title="type bevy_ecs::system::SystemParamFunction::Param">Param</a>: <a class="trait" href="trait.ReadOnlySystemParam.html" title="trait bevy_ecs::system::ReadOnlySystemParam">ReadOnlySystemParam</a>,</div></h3></section><div class="docblock"><p>SAFETY: <code>F</code>s param is <a href="trait.ReadOnlySystemParam.html" title="trait bevy_ecs::system::ReadOnlySystemParam"><code>ReadOnlySystemParam</code></a>, so this system will only read from the world.</p>
</div></div><script src="../../trait.impl/bevy_ecs/system/system/trait.ReadOnlySystem.js" async></script></section></div></main></body></html>