From 2171d1beeef781c71dc3b47359013680dd38d95b Mon Sep 17 00:00:00 2001 From: Alice Cecile Date: Mon, 10 Oct 2022 19:21:58 -0400 Subject: [PATCH 01/10] Rename system chaining to system piping --- crates/bevy_ecs/src/lib.rs | 2 +- crates/bevy_ecs/src/schedule/state.rs | 16 +++---- crates/bevy_ecs/src/system/system_chaining.rs | 47 ++++++++++--------- examples/ecs/system_chaining.rs | 2 +- 4 files changed, 35 insertions(+), 32 deletions(-) diff --git a/crates/bevy_ecs/src/lib.rs b/crates/bevy_ecs/src/lib.rs index 6143036737dbb..90fd426e43d72 100644 --- a/crates/bevy_ecs/src/lib.rs +++ b/crates/bevy_ecs/src/lib.rs @@ -38,7 +38,7 @@ pub mod prelude { Schedule, Stage, StageLabel, State, SystemLabel, SystemSet, SystemStage, }, system::{ - adapter as system_adapter, Commands, In, IntoChainSystem, IntoSystem, Local, NonSend, + adapter as system_adapter, Commands, In, IntoPipeSystem, IntoSystem, Local, NonSend, NonSendMut, ParallelCommands, ParamSet, Query, RemovedComponents, Res, ResMut, Resource, System, SystemParamFunction, }, diff --git a/crates/bevy_ecs/src/schedule/state.rs b/crates/bevy_ecs/src/schedule/state.rs index 3037500b6caa6..3ad5dbef5f059 100644 --- a/crates/bevy_ecs/src/schedule/state.rs +++ b/crates/bevy_ecs/src/schedule/state.rs @@ -3,7 +3,7 @@ use crate::{ RunCriteriaDescriptor, RunCriteriaDescriptorCoercion, RunCriteriaLabel, ShouldRun, SystemSet, }, - system::{In, IntoChainSystem, Local, Res, ResMut, Resource}, + system::{In, IntoPipeSystem, Local, Res, ResMut, Resource}, }; use std::{ any::TypeId, @@ -79,7 +79,7 @@ where (move |state: Res>| { state.stack.last().unwrap() == &pred && state.transition.is_none() }) - .chain(should_run_adapter::) + .pipe(should_run_adapter::) .after(DriverLabel::of::()) } @@ -95,7 +95,7 @@ where Some(_) => false, None => *is_inactive, }) - .chain(should_run_adapter::) + .pipe(should_run_adapter::) .after(DriverLabel::of::()) } @@ -118,7 +118,7 @@ where Some(_) => false, None => *is_in_stack, }) - .chain(should_run_adapter::) + .pipe(should_run_adapter::) .after(DriverLabel::of::()) } @@ -133,7 +133,7 @@ where _ => false, }) }) - .chain(should_run_adapter::) + .pipe(should_run_adapter::) .after(DriverLabel::of::()) } @@ -148,7 +148,7 @@ where _ => false, }) }) - .chain(should_run_adapter::) + .pipe(should_run_adapter::) .after(DriverLabel::of::()) } @@ -162,7 +162,7 @@ where _ => false, }) }) - .chain(should_run_adapter::) + .pipe(should_run_adapter::) .after(DriverLabel::of::()) } @@ -176,7 +176,7 @@ where _ => false, }) }) - .chain(should_run_adapter::) + .pipe(should_run_adapter::) .after(DriverLabel::of::()) } diff --git a/crates/bevy_ecs/src/system/system_chaining.rs b/crates/bevy_ecs/src/system/system_chaining.rs index 17e0c0455bc39..417271bf9b7b1 100644 --- a/crates/bevy_ecs/src/system/system_chaining.rs +++ b/crates/bevy_ecs/src/system/system_chaining.rs @@ -7,10 +7,11 @@ use crate::{ }; use std::borrow::Cow; -/// A [`System`] that chains two systems together, creating a new system that routes the output of -/// the first system into the input of the second system, yielding the output of the second system. +/// A [`System`] created by piping the output of the first system into the input of the second. /// -/// Given two systems `A` and `B`, A may be chained with `B` as `A.chain(B)` if the output type of `A` is +/// This can be repeated indefintely, but system pipes cannot branch: the output is consumed by the receiving system. +/// +/// Given two systems `A` and `B`, A may be piped into `B` as `A.pipe(B)` if the output type of `A` is /// equal to the input type of `B`. /// /// Note that for [`FunctionSystem`](crate::system::FunctionSystem)s the output is the return value @@ -29,9 +30,9 @@ use std::borrow::Cow; /// world.insert_resource(Message("42".to_string())); /// /// // chain the `parse_message_system`'s output into the `filter_system`s input -/// let mut chained_system = parse_message_system.chain(filter_system); -/// chained_system.initialize(&mut world); -/// assert_eq!(chained_system.run((), &mut world), Some(42)); +/// let mut piped_system = parse_message_system.pipe(filter_system); +/// piped_system.initialize(&mut world); +/// assert_eq!(piped_system.run((), &mut world), Some(42)); /// } /// /// #[derive(Resource)] @@ -45,7 +46,7 @@ use std::borrow::Cow; /// result.ok().filter(|&n| n < 100) /// } /// ``` -pub struct ChainSystem { +pub struct PipeSystem { system_a: SystemA, system_b: SystemB, name: Cow<'static, str>, @@ -53,7 +54,7 @@ pub struct ChainSystem { archetype_component_access: Access, } -impl> System for ChainSystem { +impl> System for PipeSystem { type In = SystemA::In; type Out = SystemB::Out; @@ -121,33 +122,35 @@ impl> System for ChainSystem } } -/// An extension trait providing the [`IntoChainSystem::chain`] method for convenient [`System`] -/// chaining. +/// An extension trait providing the [`IntoPipeSystem::pipe`] method to pass input from one system into the next. +/// +/// The first system must have a non-empty return type `T` +/// and the second system must have [`In`](crate::system::In) as its first system parameter. /// -/// This trait is blanket implemented for all system pairs that fulfill the chaining requirement. +/// This trait is blanket implemented for all system pairs that fulfill the type requirements. /// -/// See [`ChainSystem`]. -pub trait IntoChainSystem: +/// See [`PipeSystem`]. +pub trait IntoPipeSystem: IntoSystem<(), Payload, ParamA> + Sized where SystemB: IntoSystem, { /// Chain this system `A` with another system `B` creating a new system that feeds system A's /// output into system `B`, returning the output of system `B`. - fn chain(self, system: SystemB) -> ChainSystem; + fn pipe(self, system: SystemB) -> PipeSystem; } impl - IntoChainSystem for SystemA + IntoPipeSystem for SystemA where SystemA: IntoSystem<(), Payload, ParamA>, SystemB: IntoSystem, { - fn chain(self, system: SystemB) -> ChainSystem { + fn pipe(self, system: SystemB) -> PipeSystem { let system_a = IntoSystem::into_system(self); let system_b = IntoSystem::into_system(system); - ChainSystem { - name: Cow::Owned(format!("Chain({}, {})", system_a.name(), system_b.name())), + PipeSystem { + name: Cow::Owned(format!("Pipe({}, {})", system_a.name(), system_b.name())), system_a, system_b, archetype_component_access: Default::default(), @@ -156,7 +159,7 @@ where } } -/// A collection of common adapters for [chaining](super::ChainSystem) the result of a system. +/// A collection of common adapters for [piping](super::PipeSystem) the result of a system. pub mod adapter { use crate::system::In; use std::fmt::Debug; @@ -278,8 +281,8 @@ pub mod adapter { unimplemented!() } - assert_is_system(returning::>.chain(unwrap)); - assert_is_system(returning::>.chain(ignore)); - assert_is_system(returning::<&str>.chain(new(u64::from_str)).chain(unwrap)); + assert_is_system(returning::>.pipe(unwrap)); + assert_is_system(returning::>.pipe(ignore)); + assert_is_system(returning::<&str>.pipe(new(u64::from_str)).pipe(unwrap)); } } diff --git a/examples/ecs/system_chaining.rs b/examples/ecs/system_chaining.rs index 8046dcd7ec3d1..6eab079c33616 100644 --- a/examples/ecs/system_chaining.rs +++ b/examples/ecs/system_chaining.rs @@ -7,7 +7,7 @@ use bevy::prelude::*; fn main() { App::new() .insert_resource(Message("42".to_string())) - .add_system(parse_message_system.chain(handler_system)) + .add_system(parse_message_system.pipe(handler_system)) .run(); } From 393161c2a662dd36b781dc78dcb3e2cb9244d2f3 Mon Sep 17 00:00:00 2001 From: Alice Cecile Date: Mon, 10 Oct 2022 19:22:19 -0400 Subject: [PATCH 02/10] Rename file --- crates/bevy_ecs/src/system/mod.rs | 4 ++-- .../src/system/{system_chaining.rs => system_piping.rs} | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename crates/bevy_ecs/src/system/{system_chaining.rs => system_piping.rs} (100%) diff --git a/crates/bevy_ecs/src/system/mod.rs b/crates/bevy_ecs/src/system/mod.rs index bb177a279ac2e..2243636e3182f 100644 --- a/crates/bevy_ecs/src/system/mod.rs +++ b/crates/bevy_ecs/src/system/mod.rs @@ -75,8 +75,8 @@ mod function_system; mod query; #[allow(clippy::module_inception)] mod system; -mod system_chaining; mod system_param; +mod system_piping; pub use commands::*; pub use exclusive_function_system::*; @@ -84,8 +84,8 @@ pub use exclusive_system_param::*; pub use function_system::*; pub use query::*; pub use system::*; -pub use system_chaining::*; pub use system_param::*; +pub use system_piping::*; /// Ensure that a given function is a system /// diff --git a/crates/bevy_ecs/src/system/system_chaining.rs b/crates/bevy_ecs/src/system/system_piping.rs similarity index 100% rename from crates/bevy_ecs/src/system/system_chaining.rs rename to crates/bevy_ecs/src/system/system_piping.rs From c7b3cb537bb0a20d7220fbe128ae246d7a52ceb5 Mon Sep 17 00:00:00 2001 From: Alice Cecile Date: Mon, 10 Oct 2022 19:23:57 -0400 Subject: [PATCH 03/10] Rename example --- Cargo.toml | 6 +++--- examples/README.md | 2 +- examples/ecs/{system_chaining.rs => system_piping.rs} | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) rename examples/ecs/{system_chaining.rs => system_piping.rs} (91%) diff --git a/Cargo.toml b/Cargo.toml index 6612b1630986e..f7c17942e67e0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -872,10 +872,10 @@ category = "ECS (Entity Component System)" wasm = false [[example]] -name = "system_chaining" -path = "examples/ecs/system_chaining.rs" +name = "system_piping" +path = "examples/ecs/system_piping.rs" -[package.metadata.example.system_chaining] +[package.metadata.example.system_piping] name = "System Chaining" description = "Chain two systems together, specifying a return type in a system (such as `Result`)" category = "ECS (Entity Component System)" diff --git a/examples/README.md b/examples/README.md index 18853ac19db1a..293d99d420f54 100644 --- a/examples/README.md +++ b/examples/README.md @@ -199,7 +199,7 @@ Example | Description [Removal Detection](../examples/ecs/removal_detection.rs) | Query for entities that had a specific component removed in a previous stage during the current frame [Startup System](../examples/ecs/startup_system.rs) | Demonstrates a startup system (one that runs once when the app starts up) [State](../examples/ecs/state.rs) | Illustrates how to use States to control transitioning from a Menu state to an InGame state -[System Chaining](../examples/ecs/system_chaining.rs) | Chain two systems together, specifying a return type in a system (such as `Result`) +[System Chaining](../examples/ecs/system_piping.rs) | Chain two systems together, specifying a return type in a system (such as `Result`) [System Closure](../examples/ecs/system_closure.rs) | Show how to use closures as systems, and how to configure `Local` variables by capturing external state [System Parameter](../examples/ecs/system_param.rs) | Illustrates creating custom system parameters with `SystemParam` [System Sets](../examples/ecs/system_sets.rs) | Shows `SystemSet` use along with run criterion diff --git a/examples/ecs/system_chaining.rs b/examples/ecs/system_piping.rs similarity index 91% rename from examples/ecs/system_chaining.rs rename to examples/ecs/system_piping.rs index 6eab079c33616..ca023ab7afef3 100644 --- a/examples/ecs/system_chaining.rs +++ b/examples/ecs/system_piping.rs @@ -1,5 +1,5 @@ -//! Illustrates how to make a single system from multiple functions running in sequence and sharing -//! their inputs and outputs. +//! Illustrates how to make a single system from multiple functions running in sequence, +//! passing the output of the first into the input of the next. use anyhow::Result; use bevy::prelude::*; From ab3547e592d0f9e930e0a4be2ca344f6046fc277 Mon Sep 17 00:00:00 2001 From: Alice Cecile Date: Mon, 10 Oct 2022 19:26:37 -0400 Subject: [PATCH 04/10] Rename in docs --- crates/bevy_ecs/src/system/function_system.rs | 6 +++--- crates/bevy_ecs/src/system/system_piping.rs | 17 ++++++++--------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/crates/bevy_ecs/src/system/function_system.rs b/crates/bevy_ecs/src/system/function_system.rs index 5cbaa6d88c379..664aeaa316fd4 100644 --- a/crates/bevy_ecs/src/system/function_system.rs +++ b/crates/bevy_ecs/src/system/function_system.rs @@ -535,9 +535,9 @@ impl Copy for SystemTypeIdLabel {} /// world.insert_resource(Message("42".to_string())); /// /// // chain the `parse_message_system`'s output into the `filter_system`s input -/// let mut chained_system = IntoSystem::into_system(chain(parse_message, filter)); -/// chained_system.initialize(&mut world); -/// assert_eq!(chained_system.run((), &mut world), Some(42)); +/// let mut piped_system = IntoSystem::into_system(chain(parse_message, filter)); +/// piped_system.initialize(&mut world); +/// assert_eq!(piped_system.run((), &mut world), Some(42)); /// } /// /// #[derive(Resource)] diff --git a/crates/bevy_ecs/src/system/system_piping.rs b/crates/bevy_ecs/src/system/system_piping.rs index 417271bf9b7b1..94fef9823ea24 100644 --- a/crates/bevy_ecs/src/system/system_piping.rs +++ b/crates/bevy_ecs/src/system/system_piping.rs @@ -29,7 +29,7 @@ use std::borrow::Cow; /// let mut world = World::default(); /// world.insert_resource(Message("42".to_string())); /// -/// // chain the `parse_message_system`'s output into the `filter_system`s input +/// // pipe the `parse_message_system`'s output into the `filter_system`s input /// let mut piped_system = parse_message_system.pipe(filter_system); /// piped_system.initialize(&mut world); /// assert_eq!(piped_system.run((), &mut world), Some(42)); @@ -135,8 +135,7 @@ pub trait IntoPipeSystem: where SystemB: IntoSystem, { - /// Chain this system `A` with another system `B` creating a new system that feeds system A's - /// output into system `B`, returning the output of system `B`. + /// Pass the output of this system `A` into a second system `B`, creating a new compound system. fn pipe(self, system: SystemB) -> PipeSystem; } @@ -171,9 +170,9 @@ pub mod adapter { /// use bevy_ecs::prelude::*; /// /// return1 - /// .chain(system_adapter::new(u32::try_from)) - /// .chain(system_adapter::unwrap) - /// .chain(print); + /// .pipe(system_adapter::new(u32::try_from)) + /// .pipe(system_adapter::unwrap) + /// .pipe(print); /// /// fn return1() -> u64 { 1 } /// fn print(In(x): In) { @@ -207,7 +206,7 @@ pub mod adapter { /// .add_system_to_stage( /// CoreStage::Update, /// // Panic if the load system returns an error. - /// load_save_system.chain(system_adapter::unwrap) + /// load_save_system.pipe(system_adapter::unwrap) /// ) /// // ... /// # ; @@ -227,7 +226,7 @@ pub mod adapter { res.unwrap() } - /// System adapter that ignores the output of the previous system in a chain. + /// System adapter that ignores the output of the previous system in a pipe. /// This is useful for fallible systems that should simply return early in case of an `Err`/`None`. /// /// # Examples @@ -251,7 +250,7 @@ pub mod adapter { /// .add_system_to_stage( /// CoreStage::Update, /// // If the system fails, just move on and try again next frame. - /// fallible_system.chain(system_adapter::ignore) + /// fallible_system.pipe(system_adapter::ignore) /// ) /// // ... /// # ; From 8731c7d2e62c8f33ed3d6453132420e0809b3712 Mon Sep 17 00:00:00 2001 From: Alice Cecile Date: Mon, 10 Oct 2022 20:34:45 -0400 Subject: [PATCH 05/10] Typo fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: François --- crates/bevy_ecs/src/system/system_piping.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_ecs/src/system/system_piping.rs b/crates/bevy_ecs/src/system/system_piping.rs index 94fef9823ea24..ac55a1acc4c42 100644 --- a/crates/bevy_ecs/src/system/system_piping.rs +++ b/crates/bevy_ecs/src/system/system_piping.rs @@ -9,7 +9,7 @@ use std::borrow::Cow; /// A [`System`] created by piping the output of the first system into the input of the second. /// -/// This can be repeated indefintely, but system pipes cannot branch: the output is consumed by the receiving system. +/// This can be repeated indefinitely, but system pipes cannot branch: the output is consumed by the receiving system. /// /// Given two systems `A` and `B`, A may be piped into `B` as `A.pipe(B)` if the output type of `A` is /// equal to the input type of `B`. From 3d2e0d0882575ed37ca66f17e443af4534f726c5 Mon Sep 17 00:00:00 2001 From: Alice Cecile Date: Mon, 10 Oct 2022 20:41:19 -0400 Subject: [PATCH 06/10] Fix example name and description --- Cargo.toml | 4 ++-- examples/README.md | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f7c17942e67e0..560ae5807f43c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -876,8 +876,8 @@ name = "system_piping" path = "examples/ecs/system_piping.rs" [package.metadata.example.system_piping] -name = "System Chaining" -description = "Chain two systems together, specifying a return type in a system (such as `Result`)" +name = "System Piping" +description = "Pipe the output of one system into a second, allowing you to handle any errors gracefully" category = "ECS (Entity Component System)" wasm = false diff --git a/examples/README.md b/examples/README.md index 293d99d420f54..78dac096814b7 100644 --- a/examples/README.md +++ b/examples/README.md @@ -56,6 +56,23 @@ git checkout v0.4.0 - [Transforms](#transforms) - [UI (User Interface)](#ui-user-interface) - [Window](#window) +- [Tests](#tests) +- [Platform-Specific Examples](#platform-specific-examples) + - [Android](#android) + - [Setup](#setup) + - [Build & Run](#build--run) + - [Debugging](#debugging) + - [Old phones](#old-phones) + - [iOS](#ios) + - [Setup](#setup-1) + - [Build & Run](#build--run-1) + - [WASM](#wasm) + - [Setup](#setup-2) + - [Build & Run](#build--run-2) + - [Optimizing](#optimizing) + - [1. Tweak your `Cargo.toml`](#1-tweak-your-cargotoml) + - [2. Use `wasm-opt` from the binaryen package](#2-use-wasm-opt-from-the-binaryen-package) + - [Loading Assets](#loading-assets) - [Tests](#tests) - [Platform-Specific Examples](#platform-specific-examples) @@ -199,7 +216,7 @@ Example | Description [Removal Detection](../examples/ecs/removal_detection.rs) | Query for entities that had a specific component removed in a previous stage during the current frame [Startup System](../examples/ecs/startup_system.rs) | Demonstrates a startup system (one that runs once when the app starts up) [State](../examples/ecs/state.rs) | Illustrates how to use States to control transitioning from a Menu state to an InGame state -[System Chaining](../examples/ecs/system_piping.rs) | Chain two systems together, specifying a return type in a system (such as `Result`) +[System Piping](../examples/ecs/system_piping.rs) | description = Pipe the output of one system into a second, allowing you to handle any errors gracefully [System Closure](../examples/ecs/system_closure.rs) | Show how to use closures as systems, and how to configure `Local` variables by capturing external state [System Parameter](../examples/ecs/system_param.rs) | Illustrates creating custom system parameters with `SystemParam` [System Sets](../examples/ecs/system_sets.rs) | Shows `SystemSet` use along with run criterion From 1ae67fe47b5de8624c994443f0062b17e84ec256 Mon Sep 17 00:00:00 2001 From: Alice Cecile Date: Mon, 10 Oct 2022 20:44:54 -0400 Subject: [PATCH 07/10] Update SystemParamFunction docs --- crates/bevy_ecs/src/system/function_system.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/bevy_ecs/src/system/function_system.rs b/crates/bevy_ecs/src/system/function_system.rs index 664aeaa316fd4..f5d0611fb8418 100644 --- a/crates/bevy_ecs/src/system/function_system.rs +++ b/crates/bevy_ecs/src/system/function_system.rs @@ -499,7 +499,7 @@ impl Copy for SystemTypeIdLabel {} /// /// # Example /// -/// To create something like [`ChainSystem`], but in entirely safe code. +/// To create something like [`PipeSystem`], but in entirely safe code. /// /// ```rust /// use std::num::ParseIntError; @@ -510,8 +510,8 @@ impl Copy for SystemTypeIdLabel {} /// // Unfortunately, we need all of these generics. `A` is the first system, with its /// // parameters and marker type required for coherence. `B` is the second system, and /// // the other generics are for the input/output types of `A` and `B`. -/// /// Chain creates a new system which calls `a`, then calls `b` with the output of `a` -/// pub fn chain( +/// /// Pipe creates a new system which calls `a`, then calls `b` with the output of `a` +/// pub fn pipe( /// mut a: A, /// mut b: B, /// ) -> impl FnMut(In, ParamSet<(SystemParamItem, SystemParamItem)>) -> BOut @@ -551,7 +551,7 @@ impl Copy for SystemTypeIdLabel {} /// result.ok().filter(|&n| n < 100) /// } /// ``` -/// [`ChainSystem`]: crate::system::ChainSystem +/// [`PipeSystem`]: crate::system::PipeSystem /// [`ParamSet`]: crate::system::ParamSet pub trait SystemParamFunction: Send + Sync + 'static { fn run(&mut self, input: In, param_value: SystemParamItem) -> Out; From 16ef4932ee0961fa44c455bc7e078f24cdc721a9 Mon Sep 17 00:00:00 2001 From: Alice Cecile Date: Mon, 10 Oct 2022 20:45:46 -0400 Subject: [PATCH 08/10] Nit: you can chain systems with () return types Co-authored-by: JoJoJet <21144246+JoJoJet@users.noreply.github.com> --- crates/bevy_ecs/src/system/system_piping.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_ecs/src/system/system_piping.rs b/crates/bevy_ecs/src/system/system_piping.rs index ac55a1acc4c42..4f4a192ff535d 100644 --- a/crates/bevy_ecs/src/system/system_piping.rs +++ b/crates/bevy_ecs/src/system/system_piping.rs @@ -124,7 +124,7 @@ impl> System for PipeSystem< /// An extension trait providing the [`IntoPipeSystem::pipe`] method to pass input from one system into the next. /// -/// The first system must have a non-empty return type `T` +/// The first system must have return type `T` /// and the second system must have [`In`](crate::system::In) as its first system parameter. /// /// This trait is blanket implemented for all system pairs that fulfill the type requirements. From 52e2fb41e1666bbdb0fea31c0d4b53b31ba6cf54 Mon Sep 17 00:00:00 2001 From: Alice Cecile Date: Mon, 10 Oct 2022 21:11:40 -0400 Subject: [PATCH 09/10] cargo run -p build-example-pages -- update --- examples/README.md | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/examples/README.md b/examples/README.md index 78dac096814b7..4e105d66d9ee3 100644 --- a/examples/README.md +++ b/examples/README.md @@ -56,23 +56,6 @@ git checkout v0.4.0 - [Transforms](#transforms) - [UI (User Interface)](#ui-user-interface) - [Window](#window) -- [Tests](#tests) -- [Platform-Specific Examples](#platform-specific-examples) - - [Android](#android) - - [Setup](#setup) - - [Build & Run](#build--run) - - [Debugging](#debugging) - - [Old phones](#old-phones) - - [iOS](#ios) - - [Setup](#setup-1) - - [Build & Run](#build--run-1) - - [WASM](#wasm) - - [Setup](#setup-2) - - [Build & Run](#build--run-2) - - [Optimizing](#optimizing) - - [1. Tweak your `Cargo.toml`](#1-tweak-your-cargotoml) - - [2. Use `wasm-opt` from the binaryen package](#2-use-wasm-opt-from-the-binaryen-package) - - [Loading Assets](#loading-assets) - [Tests](#tests) - [Platform-Specific Examples](#platform-specific-examples) @@ -216,9 +199,9 @@ Example | Description [Removal Detection](../examples/ecs/removal_detection.rs) | Query for entities that had a specific component removed in a previous stage during the current frame [Startup System](../examples/ecs/startup_system.rs) | Demonstrates a startup system (one that runs once when the app starts up) [State](../examples/ecs/state.rs) | Illustrates how to use States to control transitioning from a Menu state to an InGame state -[System Piping](../examples/ecs/system_piping.rs) | description = Pipe the output of one system into a second, allowing you to handle any errors gracefully [System Closure](../examples/ecs/system_closure.rs) | Show how to use closures as systems, and how to configure `Local` variables by capturing external state [System Parameter](../examples/ecs/system_param.rs) | Illustrates creating custom system parameters with `SystemParam` +[System Piping](../examples/ecs/system_piping.rs) | Pipe the output of one system into a second, allowing you to handle any errors gracefully [System Sets](../examples/ecs/system_sets.rs) | Shows `SystemSet` use along with run criterion [Timers](../examples/ecs/timers.rs) | Illustrates ticking `Timer` resources inside systems and handling their state From a85ed8d69920923f8fc07954ed79f2eebf32e784 Mon Sep 17 00:00:00 2001 From: Alice Cecile Date: Tue, 11 Oct 2022 08:46:13 -0400 Subject: [PATCH 10/10] Fix doc example in function_system.rs --- crates/bevy_ecs/src/system/function_system.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/bevy_ecs/src/system/function_system.rs b/crates/bevy_ecs/src/system/function_system.rs index f5d0611fb8418..c3f672e718734 100644 --- a/crates/bevy_ecs/src/system/function_system.rs +++ b/crates/bevy_ecs/src/system/function_system.rs @@ -529,13 +529,13 @@ impl Copy for SystemTypeIdLabel {} /// } /// } /// -/// // Usage example for `chain`: +/// // Usage example for `pipe`: /// fn main() { /// let mut world = World::default(); /// world.insert_resource(Message("42".to_string())); /// -/// // chain the `parse_message_system`'s output into the `filter_system`s input -/// let mut piped_system = IntoSystem::into_system(chain(parse_message, filter)); +/// // pipe the `parse_message_system`'s output into the `filter_system`s input +/// let mut piped_system = IntoSystem::into_system(pipe(parse_message, filter)); /// piped_system.initialize(&mut world); /// assert_eq!(piped_system.run((), &mut world), Some(42)); /// }