From 17e509748dd8027d147f4361c6a538535b66eda9 Mon Sep 17 00:00:00 2001 From: Stepan Koltsov Date: Thu, 16 Nov 2023 17:44:42 +0000 Subject: [PATCH] Some docs for IntoSystemSet (#10563) Co-authored-by: Pascal Hertleif Co-authored-by: Alice Cecile --- crates/bevy_ecs/src/schedule/config.rs | 39 ++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/crates/bevy_ecs/src/schedule/config.rs b/crates/bevy_ecs/src/schedule/config.rs index 1c60f5b3da..3ce86039ad 100644 --- a/crates/bevy_ecs/src/schedule/config.rs +++ b/crates/bevy_ecs/src/schedule/config.rs @@ -206,6 +206,39 @@ impl NodeConfigs { } /// Types that can convert into a [`SystemConfigs`]. +/// +/// This trait is implemented for "systems" (functions whose arguments all implement +/// [`SystemParam`](crate::system::SystemParam)), or tuples thereof. +/// It is a common entry point for system configurations. +/// +/// # Examples +/// +/// ``` +/// # use bevy_ecs::schedule::IntoSystemConfigs; +/// # struct AppMock; +/// # struct Update; +/// # impl AppMock { +/// # pub fn add_systems( +/// # &mut self, +/// # schedule: Update, +/// # systems: impl IntoSystemConfigs, +/// # ) -> &mut Self { self } +/// # } +/// # let mut app = AppMock; +/// +/// fn handle_input() {} +/// +/// fn update_camera() {} +/// fn update_character() {} +/// +/// app.add_systems( +/// Update, +/// ( +/// handle_input, +/// (update_camera, update_character).after(handle_input) +/// ) +/// ); +/// ``` pub trait IntoSystemConfigs where Self: Sized, @@ -221,11 +254,17 @@ where } /// Run before all systems in `set`. + /// + /// Note: The given set is not implicitly added to the schedule when this system set is added. + /// It is safe, but no dependencies will be created. fn before(self, set: impl IntoSystemSet) -> SystemConfigs { self.into_configs().before(set) } /// Run after all systems in `set`. + /// + /// Note: The given set is not implicitly added to the schedule when this system set is added. + /// It is safe, but no dependencies will be created. fn after(self, set: impl IntoSystemSet) -> SystemConfigs { self.into_configs().after(set) }