diff --git a/benches/benches/bevy_ecs/stages.rs b/benches/benches/bevy_ecs/stages.rs index 01421622fb..e4fce66f0f 100644 --- a/benches/benches/bevy_ecs/stages.rs +++ b/benches/benches/bevy_ecs/stages.rs @@ -1,7 +1,7 @@ use bevy::ecs::{ - world::World, schedule::{Stage, SystemStage}, system::{IntoSystem, Query}, + world::World, }; use criterion::{criterion_group, criterion_main, Criterion}; @@ -29,7 +29,7 @@ fn empty_systems(criterion: &mut Criterion) { for amount in 0..5 { let mut stage = SystemStage::parallel(); for _ in 0..amount { - stage.add_system(empty.system()); + stage.add_system(empty); } run_stage(&mut stage, &mut world); group.bench_function(&format!("{:03}_systems", amount), |bencher| { @@ -42,11 +42,11 @@ fn empty_systems(criterion: &mut Criterion) { let mut stage = SystemStage::parallel(); for _ in 0..amount { stage - .add_system(empty.system()) - .add_system(empty.system()) - .add_system(empty.system()) - .add_system(empty.system()) - .add_system(empty.system()); + .add_system(empty) + .add_system(empty) + .add_system(empty) + .add_system(empty) + .add_system(empty); } run_stage(&mut stage, &mut world); group.bench_function(&format!("{:03}_systems", 5 * amount), |bencher| { @@ -85,15 +85,9 @@ fn busy_systems(criterion: &mut Criterion) { world.spawn_batch((0..ENTITY_BUNCH).map(|_| (A(0.0), B(0.0), C(0.0), E(0.0)))); for system_amount in 0..5 { let mut stage = SystemStage::parallel(); - stage - .add_system(ab.system()) - .add_system(cd.system()) - .add_system(ce.system()); + stage.add_system(ab).add_system(cd).add_system(ce); for _ in 0..system_amount { - stage - .add_system(ab.system()) - .add_system(cd.system()) - .add_system(ce.system()); + stage.add_system(ab).add_system(cd).add_system(ce); } run_stage(&mut stage, &mut world); group.bench_function( @@ -142,15 +136,9 @@ fn contrived(criterion: &mut Criterion) { world.spawn_batch((0..ENTITY_BUNCH).map(|_| (C(0.0), D(0.0)))); for system_amount in 0..5 { let mut stage = SystemStage::parallel(); - stage - .add_system(s_0.system()) - .add_system(s_1.system()) - .add_system(s_2.system()); + stage.add_system(s_0).add_system(s_1).add_system(s_2); for _ in 0..system_amount { - stage - .add_system(s_0.system()) - .add_system(s_1.system()) - .add_system(s_2.system()); + stage.add_system(s_0).add_system(s_1).add_system(s_2); } run_stage(&mut stage, &mut world); group.bench_function( diff --git a/crates/bevy_app/src/app.rs b/crates/bevy_app/src/app.rs index cf64ea7b0a..d418220540 100644 --- a/crates/bevy_app/src/app.rs +++ b/crates/bevy_app/src/app.rs @@ -1,7 +1,7 @@ use crate::{CoreStage, Events, Plugin, PluginGroup, PluginGroupBuilder, StartupStage}; use bevy_ecs::{ component::{Component, ComponentDescriptor}, - prelude::{FromWorld, IntoExclusiveSystem, IntoSystem}, + prelude::{FromWorld, IntoExclusiveSystem}, schedule::{ IntoSystemDescriptor, RunOnce, Schedule, Stage, StageLabel, State, SystemSet, SystemStage, }, @@ -28,7 +28,7 @@ use bevy_utils::tracing::info_span; /// /// fn main() { /// App::new() -/// .add_system(hello_world_system.system()) +/// .add_system(hello_world_system) /// .run(); /// } /// @@ -180,7 +180,7 @@ impl App { /// Adds a system that runs every time `app.update()` is called by the runner /// /// Systems are the main building block in the Bevy ECS app model. You can define - /// normal rust functions, and call `.system()` to make them be Bevy systems. + /// normal rust functions, and use them as a Bevy system. /// /// System functions can have parameters, through which one can query and /// mutate Bevy ECS states. @@ -201,7 +201,7 @@ impl App { /// } /// /// App::new() - /// .add_system(my_system.system()); + /// .add_system(my_system); /// ``` pub fn add_system(&mut self, system: impl IntoSystemDescriptor) -> &mut Self { self.add_system_to_stage(CoreStage::Update, system) @@ -248,7 +248,7 @@ impl App { /// } /// /// App::new() - /// .add_startup_system(my_startup_system.system()); + /// .add_startup_system(my_startup_system); /// ``` pub fn add_startup_system( &mut self, @@ -335,7 +335,7 @@ impl App { T: Component, { self.insert_resource(Events::::default()) - .add_system_to_stage(CoreStage::First, Events::::update_system.system()) + .add_system_to_stage(CoreStage::First, Events::::update_system) } /// Inserts a resource to the current [App] and overwrites any resource previously added of the same type. diff --git a/crates/bevy_app/src/ci_testing.rs b/crates/bevy_app/src/ci_testing.rs index 4a41166449..5c8bc87960 100644 --- a/crates/bevy_app/src/ci_testing.rs +++ b/crates/bevy_app/src/ci_testing.rs @@ -1,7 +1,6 @@ use serde::Deserialize; use crate::{app::AppExit, App}; -use bevy_ecs::system::IntoSystem; /// Configuration for automated testing on CI #[derive(Deserialize)] @@ -32,7 +31,7 @@ pub(crate) fn setup_app(app_builder: &mut App) -> &mut App { .expect("error deserializing CI testing configuration file"); app_builder .insert_resource(config) - .add_system(ci_testing_exit_after.system()); + .add_system(ci_testing_exit_after); app_builder } diff --git a/crates/bevy_asset/src/assets.rs b/crates/bevy_asset/src/assets.rs index 29a409f131..d444cdee2d 100644 --- a/crates/bevy_asset/src/assets.rs +++ b/crates/bevy_asset/src/assets.rs @@ -3,10 +3,7 @@ use crate::{ RefChange, }; use bevy_app::{App, EventWriter, Events}; -use bevy_ecs::{ - system::{IntoSystem, ResMut}, - world::FromWorld, -}; +use bevy_ecs::{system::ResMut, world::FromWorld}; use bevy_utils::HashMap; use crossbeam_channel::Sender; use std::fmt::Debug; @@ -217,14 +214,8 @@ impl AddAsset for App { }; self.insert_resource(assets) - .add_system_to_stage( - AssetStage::AssetEvents, - Assets::::asset_event_system.system(), - ) - .add_system_to_stage( - AssetStage::LoadAssets, - update_asset_storage_system::.system(), - ) + .add_system_to_stage(AssetStage::AssetEvents, Assets::::asset_event_system) + .add_system_to_stage(AssetStage::LoadAssets, update_asset_storage_system::) .register_type::>() .add_event::>() } diff --git a/crates/bevy_asset/src/diagnostic/asset_count_diagnostics_plugin.rs b/crates/bevy_asset/src/diagnostic/asset_count_diagnostics_plugin.rs index a915d8fe88..8224edd389 100644 --- a/crates/bevy_asset/src/diagnostic/asset_count_diagnostics_plugin.rs +++ b/crates/bevy_asset/src/diagnostic/asset_count_diagnostics_plugin.rs @@ -1,7 +1,7 @@ use crate::{Asset, Assets}; use bevy_app::prelude::*; use bevy_diagnostic::{Diagnostic, DiagnosticId, Diagnostics, MAX_DIAGNOSTIC_NAME_WIDTH}; -use bevy_ecs::system::{IntoSystem, Res, ResMut}; +use bevy_ecs::system::{Res, ResMut}; /// Adds "asset count" diagnostic to an App pub struct AssetCountDiagnosticsPlugin { @@ -18,8 +18,8 @@ impl Default for AssetCountDiagnosticsPlugin { impl Plugin for AssetCountDiagnosticsPlugin { fn build(&self, app: &mut App) { - app.add_startup_system(Self::setup_system.system()) - .add_system(Self::diagnostic_system.system()); + app.add_startup_system(Self::setup_system) + .add_system(Self::diagnostic_system); } } diff --git a/crates/bevy_asset/src/lib.rs b/crates/bevy_asset/src/lib.rs index 12a3149872..0067c266ce 100644 --- a/crates/bevy_asset/src/lib.rs +++ b/crates/bevy_asset/src/lib.rs @@ -27,10 +27,7 @@ pub use loader::*; pub use path::*; use bevy_app::{prelude::Plugin, App}; -use bevy_ecs::{ - schedule::{StageLabel, SystemStage}, - system::IntoSystem, -}; +use bevy_ecs::schedule::{StageLabel, SystemStage}; use bevy_tasks::IoTaskPool; /// The names of asset stages in an App Schedule @@ -106,16 +103,13 @@ impl Plugin for AssetPlugin { .register_type::() .add_system_to_stage( bevy_app::CoreStage::PreUpdate, - asset_server::free_unused_assets_system.system(), + asset_server::free_unused_assets_system, ); #[cfg(all( feature = "filesystem_watcher", all(not(target_arch = "wasm32"), not(target_os = "android")) ))] - app.add_system_to_stage( - AssetStage::LoadAssets, - io::filesystem_watcher_system.system(), - ); + app.add_system_to_stage(AssetStage::LoadAssets, io::filesystem_watcher_system); } } diff --git a/crates/bevy_core/src/label.rs b/crates/bevy_core/src/label.rs index ce7b676eb6..0455bb4cb9 100644 --- a/crates/bevy_core/src/label.rs +++ b/crates/bevy_core/src/label.rs @@ -123,7 +123,6 @@ pub(crate) fn entity_labels_system( mod tests { use bevy_ecs::{ schedule::{Schedule, Stage, SystemStage}, - system::IntoSystem, world::World, }; @@ -134,7 +133,7 @@ mod tests { world.insert_resource(EntityLabels::default()); let mut schedule = Schedule::default(); schedule.add_stage("test", SystemStage::single_threaded()); - schedule.add_system_to_stage("test", entity_labels_system.system()); + schedule.add_system_to_stage("test", entity_labels_system); (world, schedule) } diff --git a/crates/bevy_core/src/lib.rs b/crates/bevy_core/src/lib.rs index 50ab218cd6..5af6bc88f2 100644 --- a/crates/bevy_core/src/lib.rs +++ b/crates/bevy_core/src/lib.rs @@ -21,7 +21,7 @@ use bevy_app::prelude::*; use bevy_ecs::{ entity::Entity, schedule::{ExclusiveSystemDescriptorCoercion, SystemLabel}, - system::{IntoExclusiveSystem, IntoSystem}, + system::IntoExclusiveSystem, }; use bevy_utils::HashSet; use std::ops::Range; @@ -62,8 +62,8 @@ impl Plugin for CorePlugin { CoreStage::First, time_system.exclusive_system().label(CoreSystem::Time), ) - .add_startup_system_to_stage(StartupStage::PostStartup, entity_labels_system.system()) - .add_system_to_stage(CoreStage::PostUpdate, entity_labels_system.system()); + .add_startup_system_to_stage(StartupStage::PostStartup, entity_labels_system) + .add_system_to_stage(CoreStage::PostUpdate, entity_labels_system); register_rust_types(app); register_math_types(app); diff --git a/crates/bevy_core/src/time/fixed_timestep.rs b/crates/bevy_core/src/time/fixed_timestep.rs index c03d87296f..3655da70db 100644 --- a/crates/bevy_core/src/time/fixed_timestep.rs +++ b/crates/bevy_core/src/time/fixed_timestep.rs @@ -4,7 +4,7 @@ use bevy_ecs::{ component::ComponentId, query::Access, schedule::ShouldRun, - system::{IntoSystem, Local, Res, ResMut, System, SystemId}, + system::{ConfigurableSystem, IntoSystem, Local, Res, ResMut, System, SystemId}, world::World, }; use bevy_utils::HashMap; @@ -179,11 +179,8 @@ impl System for FixedTimestep { } fn initialize(&mut self, world: &mut World) { - self.internal_system = Box::new( - Self::prepare_system - .system() - .config(|c| c.0 = Some(self.state.clone())), - ); + self.internal_system = + Box::new(Self::prepare_system.config(|c| c.0 = Some(self.state.clone()))); self.internal_system.initialize(world); if let Some(ref label) = self.state.label { let mut fixed_timesteps = world.get_resource_mut::().unwrap(); diff --git a/crates/bevy_diagnostic/src/entity_count_diagnostics_plugin.rs b/crates/bevy_diagnostic/src/entity_count_diagnostics_plugin.rs index b4741ed168..add37dee3c 100644 --- a/crates/bevy_diagnostic/src/entity_count_diagnostics_plugin.rs +++ b/crates/bevy_diagnostic/src/entity_count_diagnostics_plugin.rs @@ -1,6 +1,6 @@ use bevy_app::{App, Plugin}; use bevy_ecs::{ - system::{IntoExclusiveSystem, IntoSystem, ResMut}, + system::{IntoExclusiveSystem, ResMut}, world::World, }; @@ -12,7 +12,7 @@ pub struct EntityCountDiagnosticsPlugin; impl Plugin for EntityCountDiagnosticsPlugin { fn build(&self, app: &mut App) { - app.add_startup_system(Self::setup_system.system()) + app.add_startup_system(Self::setup_system) .add_system(Self::diagnostic_system.exclusive_system()); } } diff --git a/crates/bevy_diagnostic/src/frame_time_diagnostics_plugin.rs b/crates/bevy_diagnostic/src/frame_time_diagnostics_plugin.rs index 10065cf6e0..2ff6f17af4 100644 --- a/crates/bevy_diagnostic/src/frame_time_diagnostics_plugin.rs +++ b/crates/bevy_diagnostic/src/frame_time_diagnostics_plugin.rs @@ -1,7 +1,7 @@ use crate::{Diagnostic, DiagnosticId, Diagnostics}; use bevy_app::prelude::*; use bevy_core::Time; -use bevy_ecs::system::{IntoSystem, Res, ResMut}; +use bevy_ecs::system::{Res, ResMut}; /// Adds "frame time" diagnostic to an App, specifically "frame time", "fps" and "frame count" #[derive(Default)] @@ -13,9 +13,9 @@ pub struct FrameTimeDiagnosticsState { impl Plugin for FrameTimeDiagnosticsPlugin { fn build(&self, app: &mut bevy_app::App) { - app.add_startup_system(Self::setup_system.system()) + app.add_startup_system(Self::setup_system) .insert_resource(FrameTimeDiagnosticsState { frame_count: 0.0 }) - .add_system(Self::diagnostic_system.system()); + .add_system(Self::diagnostic_system); } } diff --git a/crates/bevy_diagnostic/src/log_diagnostics_plugin.rs b/crates/bevy_diagnostic/src/log_diagnostics_plugin.rs index b9172805c3..e4054b20b9 100644 --- a/crates/bevy_diagnostic/src/log_diagnostics_plugin.rs +++ b/crates/bevy_diagnostic/src/log_diagnostics_plugin.rs @@ -1,7 +1,7 @@ use super::{Diagnostic, DiagnosticId, Diagnostics}; use bevy_app::prelude::*; use bevy_core::{Time, Timer}; -use bevy_ecs::system::{IntoSystem, Res, ResMut}; +use bevy_ecs::system::{Res, ResMut}; use bevy_log::{debug, info}; use bevy_utils::Duration; @@ -36,12 +36,9 @@ impl Plugin for LogDiagnosticsPlugin { }); if self.debug { - app.add_system_to_stage( - CoreStage::PostUpdate, - Self::log_diagnostics_debug_system.system(), - ); + app.add_system_to_stage(CoreStage::PostUpdate, Self::log_diagnostics_debug_system); } else { - app.add_system_to_stage(CoreStage::PostUpdate, Self::log_diagnostics_system.system()); + app.add_system_to_stage(CoreStage::PostUpdate, Self::log_diagnostics_system); } } } diff --git a/crates/bevy_ecs/README.md b/crates/bevy_ecs/README.md index ef1d396448..478b23b915 100644 --- a/crates/bevy_ecs/README.md +++ b/crates/bevy_ecs/README.md @@ -131,7 +131,7 @@ fn main() { // Add a Stage to our schedule. Each Stage in a schedule runs all of its systems // before moving on to the next Stage schedule.add_stage("update", SystemStage::parallel() - .with_system(movement.system()) + .with_system(movement) ); // Run the schedule once. If your app has a "loop", you would run this once per loop diff --git a/crates/bevy_ecs/examples/change_detection.rs b/crates/bevy_ecs/examples/change_detection.rs index 97ece09e9e..ec80dcb939 100644 --- a/crates/bevy_ecs/examples/change_detection.rs +++ b/crates/bevy_ecs/examples/change_detection.rs @@ -24,15 +24,11 @@ fn main() { // Add systems to the Stage to execute our app logic // We can label our systems to force a specific run-order between some of them - update.add_system(spawn_entities.system().label(SimulationSystem::Spawn)); - update.add_system( - print_counter_when_changed - .system() - .after(SimulationSystem::Spawn), - ); - update.add_system(age_all_entities.system().label(SimulationSystem::Age)); - update.add_system(remove_old_entities.system().after(SimulationSystem::Age)); - update.add_system(print_changed_entities.system().after(SimulationSystem::Age)); + update.add_system(spawn_entities.label(SimulationSystem::Spawn)); + update.add_system(print_counter_when_changed.after(SimulationSystem::Spawn)); + update.add_system(age_all_entities.label(SimulationSystem::Age)); + update.add_system(remove_old_entities.after(SimulationSystem::Age)); + update.add_system(print_changed_entities.after(SimulationSystem::Age)); // Add the Stage with our systems to the Schedule schedule.add_stage("update", update); diff --git a/crates/bevy_ecs/examples/component_storage.rs b/crates/bevy_ecs/examples/component_storage.rs index 95619a6455..018f7afd47 100644 --- a/crates/bevy_ecs/examples/component_storage.rs +++ b/crates/bevy_ecs/examples/component_storage.rs @@ -22,7 +22,7 @@ fn main() { // Setup a schedule and stage to add a system querying for the just spawned entities let mut schedule = Schedule::default(); let mut update = SystemStage::parallel(); - update.add_system(query_entities.system()); + update.add_system(query_entities); schedule.add_stage("update", update); schedule.run(&mut world); diff --git a/crates/bevy_ecs/examples/events.rs b/crates/bevy_ecs/examples/events.rs index a172081cf7..a90510526f 100644 --- a/crates/bevy_ecs/examples/events.rs +++ b/crates/bevy_ecs/examples/events.rs @@ -16,13 +16,13 @@ fn main() { // called "second". In "first" we update the events and in "second" we run our systems // sending and receiving events. let mut first = SystemStage::parallel(); - first.add_system(Events::::update_system.system()); + first.add_system(Events::::update_system); schedule.add_stage("first", first); // Add systems sending and receiving events to a "second" Stage let mut second = SystemStage::parallel(); - second.add_system(sending_system.system().label(EventSystem::Sending)); - second.add_system(receiving_system.system().after(EventSystem::Sending)); + second.add_system(sending_system.label(EventSystem::Sending)); + second.add_system(receiving_system.after(EventSystem::Sending)); // Run the "second" Stage after the "first" Stage, so our Events always get updated before we use them schedule.add_stage_after("first", "second", second); diff --git a/crates/bevy_ecs/examples/resources.rs b/crates/bevy_ecs/examples/resources.rs index c898a3a7e9..9bc40b5bb3 100644 --- a/crates/bevy_ecs/examples/resources.rs +++ b/crates/bevy_ecs/examples/resources.rs @@ -16,8 +16,8 @@ fn main() { let mut update = SystemStage::parallel(); // Add systems to increase the counter and to print out the current value - update.add_system(increase_counter.system().label(CounterSystem::Increase)); - update.add_system(print_counter.system().after(CounterSystem::Increase)); + update.add_system(increase_counter.label(CounterSystem::Increase)); + update.add_system(print_counter.after(CounterSystem::Increase)); schedule.add_stage("update", update); for iteration in 1..=10 { diff --git a/crates/bevy_ecs/src/schedule/executor_parallel.rs b/crates/bevy_ecs/src/schedule/executor_parallel.rs index 1a4baf38fb..42cd131898 100644 --- a/crates/bevy_ecs/src/schedule/executor_parallel.rs +++ b/crates/bevy_ecs/src/schedule/executor_parallel.rs @@ -316,7 +316,7 @@ mod tests { use super::SchedulingEvent::{self, *}; use crate::{ schedule::{SingleThreadedExecutor, Stage, SystemStage}, - system::{IntoSystem, NonSend, Query, Res, ResMut}, + system::{NonSend, Query, Res, ResMut}, world::World, }; use async_channel::Receiver; @@ -338,9 +338,9 @@ mod tests { let mut world = World::new(); fn wants_for_nothing() {} let mut stage = SystemStage::parallel() - .with_system(wants_for_nothing.system()) - .with_system(wants_for_nothing.system()) - .with_system(wants_for_nothing.system()); + .with_system(wants_for_nothing) + .with_system(wants_for_nothing) + .with_system(wants_for_nothing); stage.run(&mut world); stage.run(&mut world); assert_eq!( @@ -356,24 +356,24 @@ mod tests { fn wants_mut(_: ResMut) {} fn wants_ref(_: Res) {} let mut stage = SystemStage::parallel() - .with_system(wants_mut.system()) - .with_system(wants_mut.system()); + .with_system(wants_mut) + .with_system(wants_mut); stage.run(&mut world); assert_eq!( receive_events(&world), vec![StartedSystems(1), StartedSystems(1),] ); let mut stage = SystemStage::parallel() - .with_system(wants_mut.system()) - .with_system(wants_ref.system()); + .with_system(wants_mut) + .with_system(wants_ref); stage.run(&mut world); assert_eq!( receive_events(&world), vec![StartedSystems(1), StartedSystems(1),] ); let mut stage = SystemStage::parallel() - .with_system(wants_ref.system()) - .with_system(wants_ref.system()); + .with_system(wants_ref) + .with_system(wants_ref); stage.run(&mut world); assert_eq!(receive_events(&world), vec![StartedSystems(2),]); } @@ -385,24 +385,24 @@ mod tests { fn wants_mut(_: Query<&mut usize>) {} fn wants_ref(_: Query<&usize>) {} let mut stage = SystemStage::parallel() - .with_system(wants_mut.system()) - .with_system(wants_mut.system()); + .with_system(wants_mut) + .with_system(wants_mut); stage.run(&mut world); assert_eq!( receive_events(&world), vec![StartedSystems(1), StartedSystems(1),] ); let mut stage = SystemStage::parallel() - .with_system(wants_mut.system()) - .with_system(wants_ref.system()); + .with_system(wants_mut) + .with_system(wants_ref); stage.run(&mut world); assert_eq!( receive_events(&world), vec![StartedSystems(1), StartedSystems(1),] ); let mut stage = SystemStage::parallel() - .with_system(wants_ref.system()) - .with_system(wants_ref.system()); + .with_system(wants_ref) + .with_system(wants_ref); stage.run(&mut world); assert_eq!(receive_events(&world), vec![StartedSystems(2),]); let mut world = World::new(); @@ -410,8 +410,8 @@ mod tests { fn wants_mut_usize(_: Query<(&mut usize, &f32)>) {} fn wants_mut_u32(_: Query<(&mut u32, &f32)>) {} let mut stage = SystemStage::parallel() - .with_system(wants_mut_usize.system()) - .with_system(wants_mut_u32.system()); + .with_system(wants_mut_usize) + .with_system(wants_mut_u32); stage.run(&mut world); assert_eq!(receive_events(&world), vec![StartedSystems(2),]); } @@ -426,12 +426,12 @@ mod tests { } fn empty() {} let mut stage = SystemStage::parallel() - .with_system(non_send.system()) - .with_system(non_send.system()) - .with_system(empty.system()) - .with_system(empty.system()) - .with_system(non_send.system()) - .with_system(non_send.system()); + .with_system(non_send) + .with_system(non_send) + .with_system(empty) + .with_system(empty) + .with_system(non_send) + .with_system(non_send); stage.run(&mut world); assert_eq!( receive_events(&world), diff --git a/crates/bevy_ecs/src/schedule/mod.rs b/crates/bevy_ecs/src/schedule/mod.rs index 67f21025cf..a1c386446c 100644 --- a/crates/bevy_ecs/src/schedule/mod.rs +++ b/crates/bevy_ecs/src/schedule/mod.rs @@ -22,10 +22,7 @@ pub use system_set::*; use std::fmt::Debug; -use crate::{ - system::{IntoSystem, System}, - world::World, -}; +use crate::{system::System, world::World}; use bevy_utils::HashMap; #[derive(Default)] @@ -79,7 +76,7 @@ impl Schedule { &mut self, system: S, ) -> &mut Self { - self.run_criteria.set(Box::new(system.system())); + self.run_criteria.set(Box::new(system)); self } diff --git a/crates/bevy_ecs/src/schedule/stage.rs b/crates/bevy_ecs/src/schedule/stage.rs index 25598fc1eb..9d5dda4bdf 100644 --- a/crates/bevy_ecs/src/schedule/stage.rs +++ b/crates/bevy_ecs/src/schedule/stage.rs @@ -1,5 +1,6 @@ use crate::{ component::ComponentId, + prelude::IntoSystem, schedule::{ graph_utils::{self, DependencyGraphError}, BoxedRunCriteria, BoxedRunCriteriaLabel, BoxedSystemLabel, DuplicateLabelStrategy, @@ -8,7 +9,6 @@ use crate::{ RunCriteriaDescriptor, RunCriteriaDescriptorOrLabel, RunCriteriaInner, ShouldRun, SingleThreadedExecutor, SystemContainer, SystemDescriptor, SystemSet, }, - system::System, world::{World, WorldId}, }; use bevy_utils::{tracing::info, HashMap, HashSet}; @@ -289,16 +289,19 @@ impl SystemStage { self } - pub fn with_run_criteria>(mut self, system: S) -> Self { - self.set_run_criteria(system); + pub fn with_run_criteria>( + mut self, + system: S, + ) -> Self { + self.set_run_criteria(system.system()); self } - pub fn set_run_criteria>( + pub fn set_run_criteria>( &mut self, system: S, ) -> &mut Self { - self.stage_run_criteria.set(Box::new(system)); + self.stage_run_criteria.set(Box::new(system.system())); self } @@ -905,14 +908,8 @@ mod tests { move |world| world.get_resource_mut::>().unwrap().push(tag) } - // This is silly. https://github.com/bevyengine/bevy/issues/1029 - macro_rules! make_parallel { - ($tag:expr) => {{ - fn parallel(mut resource: ResMut>) { - resource.push($tag) - } - parallel - }}; + fn make_parallel(tag: usize) -> impl FnMut(ResMut>) { + move |mut resource: ResMut>| resource.push(tag) } fn every_other_time(mut has_ran: Local) -> ShouldRun { @@ -930,7 +927,7 @@ mod tests { world.insert_resource(Vec::::new()); let mut stage = SystemStage::parallel() .with_system(make_exclusive(0).exclusive_system().at_start()) - .with_system(make_parallel!(1).system()) + .with_system(make_parallel(1)) .with_system(make_exclusive(2).exclusive_system().before_commands()) .with_system(make_exclusive(3).exclusive_system().at_end()); stage.run(&mut world); @@ -949,7 +946,7 @@ mod tests { let mut stage = SystemStage::parallel() .with_system(make_exclusive(2).exclusive_system().before_commands()) .with_system(make_exclusive(3).exclusive_system().at_end()) - .with_system(make_parallel!(1).system()) + .with_system(make_parallel(1)) .with_system(make_exclusive(0).exclusive_system().at_start()); stage.run(&mut world); assert_eq!( @@ -965,10 +962,10 @@ mod tests { world.get_resource_mut::>().unwrap().clear(); let mut stage = SystemStage::parallel() - .with_system(make_parallel!(2).exclusive_system().before_commands()) - .with_system(make_parallel!(3).exclusive_system().at_end()) - .with_system(make_parallel!(1).system()) - .with_system(make_parallel!(0).exclusive_system().at_start()); + .with_system(make_parallel(2).exclusive_system().before_commands()) + .with_system(make_parallel(3).exclusive_system().at_end()) + .with_system(make_parallel(1)) + .with_system(make_parallel(0).exclusive_system().at_start()); stage.run(&mut world); assert_eq!( *world.get_resource::>().unwrap(), @@ -1225,9 +1222,9 @@ mod tests { let mut world = World::new(); world.insert_resource(Vec::::new()); let mut stage = SystemStage::parallel() - .with_system(make_parallel!(1).system().after("0").label("1")) - .with_system(make_parallel!(2).system().after("1")) - .with_system(make_parallel!(0).system().label("0")); + .with_system(make_parallel(1).after("0").label("1")) + .with_system(make_parallel(2).after("1")) + .with_system(make_parallel(0).label("0")); stage.run(&mut world); stage.set_executor(Box::new(SingleThreadedExecutor::default())); stage.run(&mut world); @@ -1242,9 +1239,9 @@ mod tests { let mut world = World::new(); world.insert_resource(Vec::::new()); let mut stage = SystemStage::parallel() - .with_system(make_parallel!(1).system().label("1").before("2")) - .with_system(make_parallel!(2).system().label("2")) - .with_system(make_parallel!(0).system().before("1")); + .with_system(make_parallel(1).label("1").before("2")) + .with_system(make_parallel(2).label("2")) + .with_system(make_parallel(0).before("1")); stage.run(&mut world); stage.set_executor(Box::new(SingleThreadedExecutor::default())); stage.run(&mut world); @@ -1259,11 +1256,11 @@ mod tests { let mut world = World::new(); world.insert_resource(Vec::::new()); let mut stage = SystemStage::parallel() - .with_system(make_parallel!(2).system().label("2")) - .with_system(make_parallel!(1).system().after("0").before("2")) - .with_system(make_parallel!(0).system().label("0")) - .with_system(make_parallel!(4).system().label("4")) - .with_system(make_parallel!(3).system().after("2").before("4")); + .with_system(make_parallel(2).label("2")) + .with_system(make_parallel(1).after("0").before("2")) + .with_system(make_parallel(0).label("0")) + .with_system(make_parallel(4).label("4")) + .with_system(make_parallel(3).after("2").before("4")); stage.run(&mut world); stage.set_executor(Box::new(SingleThreadedExecutor::default())); stage.run(&mut world); @@ -1278,9 +1275,9 @@ mod tests { let mut world = World::new(); world.insert_resource(Vec::::new()); let mut stage = SystemStage::parallel() - .with_system(make_parallel!(1).system().label("first").after("0")) - .with_system(make_parallel!(2).system().after("first")) - .with_system(make_parallel!(0).system().label("first").label("0")); + .with_system(make_parallel(1).label("first").after("0")) + .with_system(make_parallel(2).after("first")) + .with_system(make_parallel(0).label("first").label("0")); stage.run(&mut world); stage.set_executor(Box::new(SingleThreadedExecutor::default())); stage.run(&mut world); @@ -1291,11 +1288,11 @@ mod tests { world.get_resource_mut::>().unwrap().clear(); let mut stage = SystemStage::parallel() - .with_system(make_parallel!(2).system().after("01").label("2")) - .with_system(make_parallel!(1).system().label("01").after("0")) - .with_system(make_parallel!(0).system().label("01").label("0")) - .with_system(make_parallel!(4).system().label("4")) - .with_system(make_parallel!(3).system().after("2").before("4")); + .with_system(make_parallel(2).after("01").label("2")) + .with_system(make_parallel(1).label("01").after("0")) + .with_system(make_parallel(0).label("01").label("0")) + .with_system(make_parallel(4).label("4")) + .with_system(make_parallel(3).after("2").before("4")); stage.run(&mut world); stage.set_executor(Box::new(SingleThreadedExecutor::default())); stage.run(&mut world); @@ -1306,17 +1303,11 @@ mod tests { world.get_resource_mut::>().unwrap().clear(); let mut stage = SystemStage::parallel() - .with_system(make_parallel!(2).system().label("234").label("2")) - .with_system(make_parallel!(1).system().before("234").after("0")) - .with_system(make_parallel!(0).system().label("0")) - .with_system(make_parallel!(4).system().label("234").label("4")) - .with_system( - make_parallel!(3) - .system() - .label("234") - .after("2") - .before("4"), - ); + .with_system(make_parallel(2).label("234").label("2")) + .with_system(make_parallel(1).before("234").after("0")) + .with_system(make_parallel(0).label("0")) + .with_system(make_parallel(4).label("234").label("4")) + .with_system(make_parallel(3).label("234").after("2").before("4")); stage.run(&mut world); stage.set_executor(Box::new(SingleThreadedExecutor::default())); stage.run(&mut world); @@ -1332,24 +1323,22 @@ mod tests { world.insert_resource(Vec::::new()); let mut stage = SystemStage::parallel() .with_system( - make_parallel!(2) - .system() + make_parallel(2) .label("2") .after("1") .before("3") .before("3"), ) .with_system( - make_parallel!(1) - .system() + make_parallel(1) .label("1") .after("0") .after("0") .before("2"), ) - .with_system(make_parallel!(0).system().label("0").before("1")) - .with_system(make_parallel!(4).system().label("4").after("3")) - .with_system(make_parallel!(3).system().label("3").after("2").before("4")); + .with_system(make_parallel(0).label("0").before("1")) + .with_system(make_parallel(4).label("4").after("3")) + .with_system(make_parallel(3).label("3").after("2").before("4")); stage.run(&mut world); for container in stage.parallel.iter() { assert!(container.dependencies().len() <= 1); @@ -1367,14 +1356,14 @@ mod tests { let mut world = World::new(); world.insert_resource(Vec::::new()); let mut stage = SystemStage::parallel() - .with_system(make_parallel!(2).system().label("2")) + .with_system(make_parallel(2).label("2")) .with_system_set( SystemSet::new() - .with_system(make_parallel!(0).system().label("0")) - .with_system(make_parallel!(4).system().label("4")) - .with_system(make_parallel!(3).system().after("2").before("4")), + .with_system(make_parallel(0).label("0")) + .with_system(make_parallel(4).label("4")) + .with_system(make_parallel(3).after("2").before("4")), ) - .with_system(make_parallel!(1).system().after("0").before("2")); + .with_system(make_parallel(1).after("0").before("2")); stage.run(&mut world); stage.set_executor(Box::new(SingleThreadedExecutor::default())); stage.run(&mut world); @@ -1391,12 +1380,11 @@ mod tests { world.insert_resource(Vec::::new()); let mut stage = SystemStage::parallel() .with_system( - make_parallel!(0) - .system() + make_parallel(0) .label("0") .with_run_criteria(every_other_time), ) - .with_system(make_parallel!(1).system().after("0")); + .with_system(make_parallel(1).after("0")); stage.run(&mut world); stage.run(&mut world); stage.set_executor(Box::new(SingleThreadedExecutor::default())); @@ -1409,13 +1397,13 @@ mod tests { world.get_resource_mut::>().unwrap().clear(); let mut stage = SystemStage::parallel() - .with_system(make_parallel!(0).system().before("1")) + .with_system(make_parallel(0).before("1")) .with_system_set( SystemSet::new() - .with_run_criteria(every_other_time.system()) - .with_system(make_parallel!(1).system().label("1")), + .with_run_criteria(every_other_time) + .with_system(make_parallel(1).label("1")), ) - .with_system(make_parallel!(2).system().after("1")); + .with_system(make_parallel(2).after("1")); stage.run(&mut world); stage.run(&mut world); stage.set_executor(Box::new(SingleThreadedExecutor::default())); @@ -1430,21 +1418,19 @@ mod tests { world.get_resource_mut::>().unwrap().clear(); let mut stage = SystemStage::parallel() .with_system_run_criteria(every_other_time.label("every other time")) - .with_system(make_parallel!(0).system().before("1")) + .with_system(make_parallel(0).before("1")) .with_system( - make_parallel!(1) - .system() + make_parallel(1) .label("1") .with_run_criteria("every other time"), ) .with_system( - make_parallel!(2) - .system() + make_parallel(2) .label("2") .after("1") .with_run_criteria("every other time"), ) - .with_system(make_parallel!(3).system().after("2")); + .with_system(make_parallel(3).after("2")); stage.run(&mut world); stage.run(&mut world); stage.set_executor(Box::new(SingleThreadedExecutor::default())); @@ -1466,34 +1452,26 @@ mod tests { } } let mut stage = SystemStage::parallel() - .with_system(make_parallel!(0).system().label("0")) + .with_system(make_parallel(0).label("0")) .with_system( - make_parallel!(1) - .system() + make_parallel(1) .label("1") .after("0") - .with_run_criteria(every_other_time.system().label("every other time")), + .with_run_criteria(every_other_time.label("every other time")), ) .with_system( - make_parallel!(2) - .system() + make_parallel(2) .label("2") .after("1") .with_run_criteria(RunCriteria::pipe("every other time", eot_piped.system())), ) .with_system( - make_parallel!(3) - .system() + make_parallel(3) .label("3") .after("2") .with_run_criteria("every other time".pipe(eot_piped.system()).label("piped")), ) - .with_system( - make_parallel!(4) - .system() - .after("3") - .with_run_criteria("piped"), - ); + .with_system(make_parallel(4).after("3").with_run_criteria("piped")); for _ in 0..4 { stage.run(&mut world); } @@ -1509,27 +1487,16 @@ mod tests { // Discarding extra criteria with matching labels. world.get_resource_mut::>().unwrap().clear(); - let mut stage = SystemStage::parallel() - .with_system(make_parallel!(0).system().before("1")) - .with_system( - make_parallel!(1).system().label("1").with_run_criteria( - every_other_time - .system() - .label_discard_if_duplicate("every other time"), - ), - ) - .with_system( - make_parallel!(2) - .system() - .label("2") - .after("1") - .with_run_criteria( - every_other_time - .system() - .label_discard_if_duplicate("every other time"), - ), - ) - .with_system(make_parallel!(3).system().after("2")); + let mut stage = + SystemStage::parallel() + .with_system(make_parallel(0).before("1")) + .with_system(make_parallel(1).label("1").with_run_criteria( + every_other_time.label_discard_if_duplicate("every other time"), + )) + .with_system(make_parallel(2).label("2").after("1").with_run_criteria( + every_other_time.label_discard_if_duplicate("every other time"), + )) + .with_system(make_parallel(3).after("2")); stage.run(&mut world); stage.run(&mut world); stage.set_executor(Box::new(SingleThreadedExecutor::default())); @@ -1547,8 +1514,8 @@ mod tests { fn duplicate_run_criteria_label_panic() { let mut world = World::new(); let mut stage = SystemStage::parallel() - .with_system_run_criteria(every_other_time.system().label("every other time")) - .with_system_run_criteria(every_other_time.system().label("every other time")); + .with_system_run_criteria(every_other_time.label("every other time")) + .with_system_run_criteria(every_other_time.label("every other time")); stage.run(&mut world); } @@ -1557,8 +1524,7 @@ mod tests { fn parallel_cycle_1() { let mut world = World::new(); world.insert_resource(Vec::::new()); - let mut stage = - SystemStage::parallel().with_system(make_parallel!(0).system().label("0").after("0")); + let mut stage = SystemStage::parallel().with_system(make_parallel(0).label("0").after("0")); stage.run(&mut world); } @@ -1568,8 +1534,8 @@ mod tests { let mut world = World::new(); world.insert_resource(Vec::::new()); let mut stage = SystemStage::parallel() - .with_system(make_parallel!(0).system().label("0").after("1")) - .with_system(make_parallel!(1).system().label("1").after("0")); + .with_system(make_parallel(0).label("0").after("1")) + .with_system(make_parallel(1).label("1").after("0")); stage.run(&mut world); } @@ -1580,9 +1546,9 @@ mod tests { world.insert_resource(Vec::::new()); let mut stage = SystemStage::parallel() - .with_system(make_parallel!(0).system().label("0")) - .with_system(make_parallel!(1).system().after("0").before("2")) - .with_system(make_parallel!(2).system().label("2").before("0")); + .with_system(make_parallel(0).label("0")) + .with_system(make_parallel(1).after("0").before("2")) + .with_system(make_parallel(2).label("2").before("0")); stage.run(&mut world); } @@ -1611,21 +1577,21 @@ mod tests { let mut world = World::new(); let mut stage = SystemStage::parallel() - .with_system(empty.system().label("0")) - .with_system(empty.system().label("1").after("0")) - .with_system(empty.system().label("2")) - .with_system(empty.system().label("3").after("2").before("4")) - .with_system(empty.system().label("4")); + .with_system(empty.label("0")) + .with_system(empty.label("1").after("0")) + .with_system(empty.label("2")) + .with_system(empty.label("3").after("2").before("4")) + .with_system(empty.label("4")); stage.initialize_systems(&mut world); stage.rebuild_orders_and_dependencies(); assert_eq!(find_ambiguities(&stage.parallel).len(), 0); let mut stage = SystemStage::parallel() - .with_system(empty.system().label("0")) - .with_system(component.system().label("1").after("0")) - .with_system(empty.system().label("2")) - .with_system(empty.system().label("3").after("2").before("4")) - .with_system(component.system().label("4")); + .with_system(empty.label("0")) + .with_system(component.label("1").after("0")) + .with_system(empty.label("2")) + .with_system(empty.label("3").after("2").before("4")) + .with_system(component.label("4")); stage.initialize_systems(&mut world); stage.rebuild_orders_and_dependencies(); let ambiguities = find_ambiguities_first_labels(&stage.parallel); @@ -1636,11 +1602,11 @@ mod tests { assert_eq!(ambiguities.len(), 1); let mut stage = SystemStage::parallel() - .with_system(empty.system().label("0")) - .with_system(resource.system().label("1").after("0")) - .with_system(empty.system().label("2")) - .with_system(empty.system().label("3").after("2").before("4")) - .with_system(resource.system().label("4")); + .with_system(empty.label("0")) + .with_system(resource.label("1").after("0")) + .with_system(empty.label("2")) + .with_system(empty.label("3").after("2").before("4")) + .with_system(resource.label("4")); stage.initialize_systems(&mut world); stage.rebuild_orders_and_dependencies(); let ambiguities = find_ambiguities_first_labels(&stage.parallel); @@ -1651,21 +1617,21 @@ mod tests { assert_eq!(ambiguities.len(), 1); let mut stage = SystemStage::parallel() - .with_system(empty.system().label("0")) - .with_system(resource.system().label("1").after("0")) - .with_system(empty.system().label("2")) - .with_system(empty.system().label("3").after("2").before("4")) - .with_system(component.system().label("4")); + .with_system(empty.label("0")) + .with_system(resource.label("1").after("0")) + .with_system(empty.label("2")) + .with_system(empty.label("3").after("2").before("4")) + .with_system(component.label("4")); stage.initialize_systems(&mut world); stage.rebuild_orders_and_dependencies(); assert_eq!(find_ambiguities(&stage.parallel).len(), 0); let mut stage = SystemStage::parallel() - .with_system(component.system().label("0")) - .with_system(resource.system().label("1").after("0")) - .with_system(empty.system().label("2")) - .with_system(component.system().label("3").after("2").before("4")) - .with_system(resource.system().label("4")); + .with_system(component.label("0")) + .with_system(resource.label("1").after("0")) + .with_system(empty.label("2")) + .with_system(component.label("3").after("2").before("4")) + .with_system(resource.label("4")); stage.initialize_systems(&mut world); stage.rebuild_orders_and_dependencies(); let ambiguities = find_ambiguities_first_labels(&stage.parallel); @@ -1680,17 +1646,11 @@ mod tests { assert_eq!(ambiguities.len(), 2); let mut stage = SystemStage::parallel() - .with_system(component.system().label("0")) - .with_system( - resource - .system() - .label("1") - .after("0") - .in_ambiguity_set("a"), - ) - .with_system(empty.system().label("2")) - .with_system(component.system().label("3").after("2").before("4")) - .with_system(resource.system().label("4").in_ambiguity_set("a")); + .with_system(component.label("0")) + .with_system(resource.label("1").after("0").in_ambiguity_set("a")) + .with_system(empty.label("2")) + .with_system(component.label("3").after("2").before("4")) + .with_system(resource.label("4").in_ambiguity_set("a")); stage.initialize_systems(&mut world); stage.rebuild_orders_and_dependencies(); let ambiguities = find_ambiguities_first_labels(&stage.parallel); @@ -1701,9 +1661,9 @@ mod tests { assert_eq!(ambiguities.len(), 1); let mut stage = SystemStage::parallel() - .with_system(component.system().label("0").before("2")) - .with_system(component.system().label("1").before("2")) - .with_system(component.system().label("2")); + .with_system(component.label("0").before("2")) + .with_system(component.label("1").before("2")) + .with_system(component.label("2")); stage.initialize_systems(&mut world); stage.rebuild_orders_and_dependencies(); let ambiguities = find_ambiguities_first_labels(&stage.parallel); @@ -1714,9 +1674,9 @@ mod tests { assert_eq!(ambiguities.len(), 1); let mut stage = SystemStage::parallel() - .with_system(component.system().label("0")) - .with_system(component.system().label("1").after("0")) - .with_system(component.system().label("2").after("0")); + .with_system(component.label("0")) + .with_system(component.label("1").after("0")) + .with_system(component.label("2").after("0")); stage.initialize_systems(&mut world); stage.rebuild_orders_and_dependencies(); let ambiguities = find_ambiguities_first_labels(&stage.parallel); @@ -1727,10 +1687,10 @@ mod tests { assert_eq!(ambiguities.len(), 1); let mut stage = SystemStage::parallel() - .with_system(component.system().label("0").before("1").before("2")) - .with_system(component.system().label("1")) - .with_system(component.system().label("2")) - .with_system(component.system().label("3").after("1").after("2")); + .with_system(component.label("0").before("1").before("2")) + .with_system(component.label("1")) + .with_system(component.label("2")) + .with_system(component.label("3").after("1").after("2")); stage.initialize_systems(&mut world); stage.rebuild_orders_and_dependencies(); let ambiguities = find_ambiguities_first_labels(&stage.parallel); @@ -1741,20 +1701,20 @@ mod tests { assert_eq!(ambiguities.len(), 1); let mut stage = SystemStage::parallel() - .with_system(component.system().label("0").before("1").before("2")) - .with_system(component.system().label("1").in_ambiguity_set("a")) - .with_system(component.system().label("2").in_ambiguity_set("a")) - .with_system(component.system().label("3").after("1").after("2")); + .with_system(component.label("0").before("1").before("2")) + .with_system(component.label("1").in_ambiguity_set("a")) + .with_system(component.label("2").in_ambiguity_set("a")) + .with_system(component.label("3").after("1").after("2")); stage.initialize_systems(&mut world); stage.rebuild_orders_and_dependencies(); let ambiguities = find_ambiguities_first_labels(&stage.parallel); assert_eq!(ambiguities.len(), 0); let mut stage = SystemStage::parallel() - .with_system(component.system().label("0").before("1").before("2")) - .with_system(component.system().label("1").in_ambiguity_set("a")) - .with_system(component.system().label("2").in_ambiguity_set("b")) - .with_system(component.system().label("3").after("1").after("2")); + .with_system(component.label("0").before("1").before("2")) + .with_system(component.label("1").in_ambiguity_set("a")) + .with_system(component.label("2").in_ambiguity_set("b")) + .with_system(component.label("3").after("1").after("2")); stage.initialize_systems(&mut world); stage.rebuild_orders_and_dependencies(); let ambiguities = find_ambiguities_first_labels(&stage.parallel); @@ -1767,20 +1727,18 @@ mod tests { let mut stage = SystemStage::parallel() .with_system( component - .system() .label("0") .before("1") .before("2") .before("3") .before("4"), ) - .with_system(component.system().label("1")) - .with_system(component.system().label("2")) - .with_system(component.system().label("3")) - .with_system(component.system().label("4")) + .with_system(component.label("1")) + .with_system(component.label("2")) + .with_system(component.label("3")) + .with_system(component.label("4")) .with_system( component - .system() .label("5") .after("1") .after("2") @@ -1819,20 +1777,18 @@ mod tests { let mut stage = SystemStage::parallel() .with_system( component - .system() .label("0") .before("1") .before("2") .before("3") .before("4"), ) - .with_system(component.system().label("1").in_ambiguity_set("a")) - .with_system(component.system().label("2").in_ambiguity_set("a")) - .with_system(component.system().label("3").in_ambiguity_set("a")) - .with_system(component.system().label("4").in_ambiguity_set("a")) + .with_system(component.label("1").in_ambiguity_set("a")) + .with_system(component.label("2").in_ambiguity_set("a")) + .with_system(component.label("3").in_ambiguity_set("a")) + .with_system(component.label("4").in_ambiguity_set("a")) .with_system( component - .system() .label("5") .after("1") .after("2") @@ -1847,26 +1803,23 @@ mod tests { let mut stage = SystemStage::parallel() .with_system( component - .system() .label("0") .before("1") .before("2") .before("3") .before("4"), ) - .with_system(component.system().label("1").in_ambiguity_set("a")) - .with_system(component.system().label("2").in_ambiguity_set("a")) + .with_system(component.label("1").in_ambiguity_set("a")) + .with_system(component.label("2").in_ambiguity_set("a")) .with_system( component - .system() .label("3") .in_ambiguity_set("a") .in_ambiguity_set("b"), ) - .with_system(component.system().label("4").in_ambiguity_set("b")) + .with_system(component.label("4").in_ambiguity_set("b")) .with_system( component - .system() .label("5") .after("1") .after("2") @@ -1997,7 +1950,7 @@ mod tests { let mut world = World::new(); world.insert_resource(0_usize); - let mut stage = SystemStage::single(query_count_system.system()); + let mut stage = SystemStage::single(query_count_system); let entity = world.spawn().insert_bundle(()).id(); stage.run(&mut world); @@ -2020,7 +1973,7 @@ mod tests { let mut world = World::new(); world.insert_resource(0_usize); let mut stage = SystemStage::parallel(); - stage.add_system(query_count_system.system()); + stage.add_system(query_count_system); let entity = world.spawn().insert_bundle(()).id(); stage.run(&mut world); @@ -2042,7 +1995,7 @@ mod tests { let mut stage = SystemStage::parallel(); fn work() {} - stage.add_system(work.system()); + stage.add_system(work); // Overflow twice for _ in 0..10 { @@ -2120,11 +2073,11 @@ mod tests { let mut world = World::new(); world.insert_resource(Vec::::new()); let mut stage = SystemStage::parallel() - .with_system(spawn_entity.system().label("spawn")) + .with_system(spawn_entity.label("spawn")) .with_system_set( SystemSet::new() - .with_run_criteria(even_number_of_entities_critiera.system()) - .with_system(count_entities.system().before("spawn")), + .with_run_criteria(even_number_of_entities_critiera) + .with_system(count_entities.before("spawn")), ); stage.run(&mut world); stage.run(&mut world); @@ -2155,10 +2108,10 @@ mod tests { let mut world = World::new(); world.insert_resource(Vec::::new()); - let mut stage_spawn = SystemStage::parallel().with_system(spawn_entity.system()); + let mut stage_spawn = SystemStage::parallel().with_system(spawn_entity); let mut stage_count = SystemStage::parallel() - .with_run_criteria(even_number_of_entities_critiera.system()) - .with_system(count_entities.system()); + .with_run_criteria(even_number_of_entities_critiera) + .with_system(count_entities); stage_count.run(&mut world); stage_spawn.run(&mut world); stage_count.run(&mut world); diff --git a/crates/bevy_ecs/src/schedule/state.rs b/crates/bevy_ecs/src/schedule/state.rs index d80fb7970d..c18b6fecdb 100644 --- a/crates/bevy_ecs/src/schedule/state.rs +++ b/crates/bevy_ecs/src/schedule/state.rs @@ -4,7 +4,7 @@ use crate::{ RunCriteriaDescriptor, RunCriteriaDescriptorCoercion, RunCriteriaLabel, ShouldRun, SystemSet, }, - system::{In, IntoChainSystem, IntoSystem, Local, Res, ResMut}, + system::{ConfigurableSystem, In, IntoChainSystem, Local, Res, ResMut}, }; use std::{any::TypeId, fmt::Debug, hash::Hash}; use thiserror::Error; @@ -97,9 +97,8 @@ where (|state: Res>, pred: Local>| { state.stack.last().unwrap() == pred.as_ref().unwrap() && state.transition.is_none() }) - .system() .config(|(_, pred)| *pred = Some(Some(s.clone()))) - .chain(should_run_adapter::.system()) + .chain(should_run_adapter::) .after(DriverLabel::of::()) .label_discard_if_duplicate(StateCallback::Update.into_label(s)) } @@ -118,9 +117,8 @@ where Some(_) => false, None => *is_inactive, }) - .system() .config(|(_, _, pred)| *pred = Some(Some(s.clone()))) - .chain(should_run_adapter::.system()) + .chain(should_run_adapter::) .after(DriverLabel::of::()) .label_discard_if_duplicate(StateCallback::InactiveUpdate.into_label(s)) } @@ -151,9 +149,8 @@ where Some(_) => false, None => *is_in_stack, }) - .system() .config(|(_, _, pred)| *pred = Some(Some(s.clone()))) - .chain(should_run_adapter::.system()) + .chain(should_run_adapter::) .after(DriverLabel::of::()) .label_discard_if_duplicate(StateCallback::InStackUpdate.into_label(s)) } @@ -171,9 +168,8 @@ where _ => false, }) }) - .system() .config(|(_, pred)| *pred = Some(Some(s.clone()))) - .chain(should_run_adapter::.system()) + .chain(should_run_adapter::) .after(DriverLabel::of::()) .label_discard_if_duplicate(StateCallback::Enter.into_label(s)) } @@ -189,9 +185,8 @@ where _ => false, }) }) - .system() .config(|(_, pred)| *pred = Some(Some(s.clone()))) - .chain(should_run_adapter::.system()) + .chain(should_run_adapter::) .after(DriverLabel::of::()) .label_discard_if_duplicate(StateCallback::Exit.into_label(s)) } @@ -206,9 +201,8 @@ where _ => false, }) }) - .system() .config(|(_, pred)| *pred = Some(Some(s.clone()))) - .chain(should_run_adapter::.system()) + .chain(should_run_adapter::) .after(DriverLabel::of::()) .label_discard_if_duplicate(StateCallback::Pause.into_label(s)) } @@ -223,9 +217,8 @@ where _ => false, }) }) - .system() .config(|(_, pred)| *pred = Some(Some(s.clone()))) - .chain(should_run_adapter::.system()) + .chain(should_run_adapter::) .after(DriverLabel::of::()) .label_discard_if_duplicate(StateCallback::Resume.into_label(s)) } @@ -259,8 +252,7 @@ where /// Important note: this set must be inserted **before** all other state-dependant sets to work /// properly! pub fn get_driver() -> SystemSet { - SystemSet::default() - .with_run_criteria(state_cleaner::.system().label(DriverLabel::of::())) + SystemSet::default().with_run_criteria(state_cleaner::.label(DriverLabel::of::())) } pub fn new(initial: T) -> Self { @@ -516,81 +508,63 @@ mod test { stage .add_system_set( State::on_enter_set(MyState::S1) - .with_system((|mut r: ResMut>| r.push("startup")).system()), - ) - .add_system_set( - State::on_update_set(MyState::S1).with_system( - (|mut r: ResMut>, mut s: ResMut>| { - r.push("update S1"); - s.overwrite_replace(MyState::S2).unwrap(); - }) - .system(), - ), + .with_system(|mut r: ResMut>| r.push("startup")), ) + .add_system_set(State::on_update_set(MyState::S1).with_system( + |mut r: ResMut>, mut s: ResMut>| { + r.push("update S1"); + s.overwrite_replace(MyState::S2).unwrap(); + }, + )) .add_system_set( State::on_enter_set(MyState::S2) - .with_system((|mut r: ResMut>| r.push("enter S2")).system()), - ) - .add_system_set( - State::on_update_set(MyState::S2).with_system( - (|mut r: ResMut>, mut s: ResMut>| { - r.push("update S2"); - s.overwrite_replace(MyState::S3).unwrap(); - }) - .system(), - ), + .with_system(|mut r: ResMut>| r.push("enter S2")), ) + .add_system_set(State::on_update_set(MyState::S2).with_system( + |mut r: ResMut>, mut s: ResMut>| { + r.push("update S2"); + s.overwrite_replace(MyState::S3).unwrap(); + }, + )) .add_system_set( State::on_exit_set(MyState::S2) - .with_system((|mut r: ResMut>| r.push("exit S2")).system()), + .with_system(|mut r: ResMut>| r.push("exit S2")), ) .add_system_set( State::on_enter_set(MyState::S3) - .with_system((|mut r: ResMut>| r.push("enter S3")).system()), - ) - .add_system_set( - State::on_update_set(MyState::S3).with_system( - (|mut r: ResMut>, mut s: ResMut>| { - r.push("update S3"); - s.overwrite_push(MyState::S4).unwrap(); - }) - .system(), - ), + .with_system(|mut r: ResMut>| r.push("enter S3")), ) + .add_system_set(State::on_update_set(MyState::S3).with_system( + |mut r: ResMut>, mut s: ResMut>| { + r.push("update S3"); + s.overwrite_push(MyState::S4).unwrap(); + }, + )) .add_system_set( State::on_pause_set(MyState::S3) - .with_system((|mut r: ResMut>| r.push("pause S3")).system()), - ) - .add_system_set( - State::on_update_set(MyState::S4).with_system( - (|mut r: ResMut>, mut s: ResMut>| { - r.push("update S4"); - s.overwrite_push(MyState::S5).unwrap(); - }) - .system(), - ), - ) - .add_system_set( - State::on_inactive_update_set(MyState::S4).with_system( - (|mut r: ResMut>| r.push("inactive S4")) - .system() - .label("inactive s4"), - ), + .with_system(|mut r: ResMut>| r.push("pause S3")), ) + .add_system_set(State::on_update_set(MyState::S4).with_system( + |mut r: ResMut>, mut s: ResMut>| { + r.push("update S4"); + s.overwrite_push(MyState::S5).unwrap(); + }, + )) + .add_system_set(State::on_inactive_update_set(MyState::S4).with_system( + (|mut r: ResMut>| r.push("inactive S4")).label("inactive s4"), + )) .add_system_set( State::on_update_set(MyState::S5).with_system( (|mut r: ResMut>, mut s: ResMut>| { r.push("update S5"); s.overwrite_push(MyState::S6).unwrap(); }) - .system() .after("inactive s4"), ), ) .add_system_set( State::on_inactive_update_set(MyState::S5).with_system( (|mut r: ResMut>| r.push("inactive S5")) - .system() .label("inactive s5") .after("inactive s4"), ), @@ -601,17 +575,16 @@ mod test { r.push("update S6"); s.overwrite_push(MyState::Final).unwrap(); }) - .system() .after("inactive s5"), ), ) .add_system_set( State::on_resume_set(MyState::S4) - .with_system((|mut r: ResMut>| r.push("resume S4")).system()), + .with_system(|mut r: ResMut>| r.push("resume S4")), ) .add_system_set( State::on_exit_set(MyState::S5) - .with_system((|mut r: ResMut>| r.push("exit S4")).system()), + .with_system(|mut r: ResMut>| r.push("exit S4")), ); const EXPECTED: &[&str] = &[ @@ -671,7 +644,7 @@ mod test { world.insert_resource(State::new(AppState::Main)); world.insert_resource(false); world.insert_resource("control"); - let mut stage = SystemStage::parallel().with_system(should_run_once.system()); + let mut stage = SystemStage::parallel().with_system(should_run_once); stage.run(&mut world); assert!(*world.get_resource::().unwrap(), "after control"); @@ -679,7 +652,7 @@ mod test { world.insert_resource("test"); let mut stage = SystemStage::parallel() .with_system_set(State::::get_driver()) - .with_system(should_run_once.system()); + .with_system(should_run_once); stage.run(&mut world); assert!(*world.get_resource::().unwrap(), "after test"); } diff --git a/crates/bevy_ecs/src/schedule/system_descriptor.rs b/crates/bevy_ecs/src/schedule/system_descriptor.rs index b75fbcb89f..2caa12c1e7 100644 --- a/crates/bevy_ecs/src/schedule/system_descriptor.rs +++ b/crates/bevy_ecs/src/schedule/system_descriptor.rs @@ -30,8 +30,8 @@ use crate::{ /// struct Something; /// /// SystemStage::parallel() -/// .with_system(do_something.system().label(Something)) -/// .with_system(do_the_other_thing.system().after(Something)) +/// .with_system(do_something.label(Something)) +/// .with_system(do_the_other_thing.after(Something)) /// .with_system(do_something_else.exclusive_system().at_end()); /// ``` pub enum SystemDescriptor { diff --git a/crates/bevy_ecs/src/system/exclusive_system.rs b/crates/bevy_ecs/src/system/exclusive_system.rs index 10364375f7..7050355b6b 100644 --- a/crates/bevy_ecs/src/system/exclusive_system.rs +++ b/crates/bevy_ecs/src/system/exclusive_system.rs @@ -128,7 +128,7 @@ mod tests { entity::Entity, query::With, schedule::{Stage, SystemStage}, - system::{Commands, IntoExclusiveSystem, IntoSystem, Query, ResMut}, + system::{Commands, IntoExclusiveSystem, Query, ResMut}, world::World, }; #[test] @@ -146,7 +146,7 @@ mod tests { } } - let mut stage = SystemStage::parallel().with_system(removal.system()); + let mut stage = SystemStage::parallel().with_system(removal); world.spawn().insert(0.0f32); world.insert_resource(0usize); stage.run(&mut world); @@ -176,7 +176,7 @@ mod tests { let mut world = World::new(); world.insert_resource(Vec::::new()); let mut stage = SystemStage::parallel() - .with_system(spawn_entity.system()) + .with_system(spawn_entity) .with_system(count_entities.exclusive_system()); stage.run(&mut world); stage.run(&mut world); diff --git a/crates/bevy_ecs/src/system/function_system.rs b/crates/bevy_ecs/src/system/function_system.rs index a8de42abf5..09790f742c 100644 --- a/crates/bevy_ecs/src/system/function_system.rs +++ b/crates/bevy_ecs/src/system/function_system.rs @@ -251,7 +251,7 @@ impl FunctionSystem) { /// assert_eq!(*local, 42); /// } - /// let mut system = local_is_42.system().config(|config| config.0 = Some(42)); + /// let mut system = local_is_42.config(|config| config.0 = Some(42)); /// system.initialize(world); /// system.run((), world); /// ``` diff --git a/crates/bevy_ecs/src/system/mod.rs b/crates/bevy_ecs/src/system/mod.rs index 2110bad752..92b03c1f4e 100644 --- a/crates/bevy_ecs/src/system/mod.rs +++ b/crates/bevy_ecs/src/system/mod.rs @@ -60,7 +60,7 @@ mod tests { system.run((), &mut world); } - fn run_system>(world: &mut World, system: S) { + fn run_system>(world: &mut World, system: S) { let mut schedule = Schedule::default(); let mut update = SystemStage::parallel(); update.add_system(system); @@ -121,7 +121,7 @@ mod tests { world.spawn().insert_bundle((A, C)); world.spawn().insert_bundle((A, D)); - run_system(&mut world, query_system.system()); + run_system(&mut world, query_system); assert!(*world.get_resource::().unwrap(), "system ran"); } @@ -149,7 +149,7 @@ mod tests { world.insert_resource(false); world.spawn().insert_bundle((A, B)); - run_system(&mut world, query_system.system()); + run_system(&mut world, query_system); assert!(*world.get_resource::().unwrap(), "system ran"); } @@ -179,7 +179,7 @@ mod tests { let mut schedule = Schedule::default(); let mut update = SystemStage::parallel(); - update.add_system(incr_e_on_flip.system()); + update.add_system(incr_e_on_flip); schedule.add_stage("update", update); schedule.add_stage( "clear_trackers", @@ -206,7 +206,7 @@ mod tests { fn sys(_q1: Query<&mut A>, _q2: Query<&mut A>) {} let mut world = World::default(); - run_system(&mut world, sys.system()); + run_system(&mut world, sys); } #[test] @@ -214,7 +214,7 @@ mod tests { fn sys(_q1: Query<&mut A, With>, _q2: Query<&mut A, Without>) {} let mut world = World::default(); - run_system(&mut world, sys.system()); + run_system(&mut world, sys); } #[test] @@ -222,7 +222,7 @@ mod tests { fn sys(_q1: Query<(&mut A, &B)>, _q2: Query<&mut A, Without>) {} let mut world = World::default(); - run_system(&mut world, sys.system()); + run_system(&mut world, sys); } #[test] @@ -231,14 +231,14 @@ mod tests { fn sys(_q1: Query<&A>, _q2: Query<&mut A>) {} let mut world = World::default(); - run_system(&mut world, sys.system()); + run_system(&mut world, sys); } #[test] fn query_set_system() { fn sys(mut _set: QuerySet<(Query<&mut A>, Query<&A>)>) {} let mut world = World::default(); - run_system(&mut world, sys.system()); + run_system(&mut world, sys); } #[test] @@ -247,7 +247,7 @@ mod tests { fn sys(_query: Query<&mut A>, _set: QuerySet<(Query<&mut A>, Query<&B>)>) {} let mut world = World::default(); - run_system(&mut world, sys.system()); + run_system(&mut world, sys); } #[test] @@ -256,7 +256,7 @@ mod tests { fn sys(_set_1: QuerySet<(Query<&mut A>,)>, _set_2: QuerySet<(Query<&mut A>, Query<&B>)>) {} let mut world = World::default(); - run_system(&mut world, sys.system()); + run_system(&mut world, sys); } #[derive(Default)] @@ -264,39 +264,39 @@ mod tests { _buffer: Vec, } - fn test_for_conflicting_resources>(sys: S) { + fn test_for_conflicting_resources>(sys: S) { let mut world = World::default(); world.insert_resource(BufferRes::default()); world.insert_resource(A); world.insert_resource(B); - run_system(&mut world, sys.system()); + run_system(&mut world, sys); } #[test] #[should_panic] fn conflicting_system_resources() { fn sys(_: ResMut, _: Res) {} - test_for_conflicting_resources(sys.system()) + test_for_conflicting_resources(sys) } #[test] #[should_panic] fn conflicting_system_resources_reverse_order() { fn sys(_: Res, _: ResMut) {} - test_for_conflicting_resources(sys.system()) + test_for_conflicting_resources(sys) } #[test] #[should_panic] fn conflicting_system_resources_multiple_mutable() { fn sys(_: ResMut, _: ResMut) {} - test_for_conflicting_resources(sys.system()) + test_for_conflicting_resources(sys) } #[test] fn nonconflicting_system_resources() { fn sys(_: Local, _: ResMut, _: Local, _: ResMut) {} - test_for_conflicting_resources(sys.system()) + test_for_conflicting_resources(sys) } #[test] @@ -321,7 +321,7 @@ mod tests { *modified = true; } - run_system(&mut world, sys.system()); + run_system(&mut world, sys); // ensure the system actually ran assert!(*world.get_resource::().unwrap()); @@ -352,7 +352,7 @@ mod tests { *ran = true; } - run_system(&mut world, validate_removed.system()); + run_system(&mut world, validate_removed); assert!(*world.get_resource::().unwrap(), "system ran"); } @@ -365,18 +365,10 @@ mod tests { *modified = true; } - run_system( - &mut world, - sys.system().config(|config| config.0 = Some(42)), - ); + run_system(&mut world, sys.config(|config| config.0 = Some(42))); // ensure the system actually ran assert!(*world.get_resource::().unwrap()); - - // Now do the same with omitted `.system()`. - world.insert_resource(false); - run_system(&mut world, sys.config(|config| config.0 = Some(42))); - assert!(*world.get_resource::().unwrap()); } #[test] @@ -417,7 +409,7 @@ mod tests { *modified = true; } - run_system(&mut world, sys.system()); + run_system(&mut world, sys); // ensure the system actually ran assert!(*world.get_resource::().unwrap()); diff --git a/crates/bevy_ecs/src/system/system.rs b/crates/bevy_ecs/src/system/system.rs index bd7a64c307..eabf476730 100644 --- a/crates/bevy_ecs/src/system/system.rs +++ b/crates/bevy_ecs/src/system/system.rs @@ -24,7 +24,7 @@ impl SystemId { /// /// Systems are functions with all arguments implementing [SystemParam](crate::system::SystemParam). /// -/// Systems are added to an application using `App::add_system(my_system.system())` +/// Systems are added to an application using `App::add_system(my_system)` /// or similar methods, and will generally run once per pass of the main loop. /// /// Systems are executed in parallel, in opportunistic order; data access is managed automatically. diff --git a/crates/bevy_input/src/lib.rs b/crates/bevy_input/src/lib.rs index 335f8b8033..65c70d7549 100644 --- a/crates/bevy_input/src/lib.rs +++ b/crates/bevy_input/src/lib.rs @@ -7,10 +7,7 @@ pub mod system; pub mod touch; pub use axis::*; -use bevy_ecs::{ - schedule::{ParallelSystemDescriptorCoercion, SystemLabel}, - system::IntoSystem, -}; +use bevy_ecs::schedule::{ParallelSystemDescriptorCoercion, SystemLabel}; pub use input::*; pub mod prelude { @@ -52,7 +49,7 @@ impl Plugin for InputPlugin { .init_resource::>() .add_system_to_stage( CoreStage::PreUpdate, - keyboard_input_system.system().label(InputSystem), + keyboard_input_system.label(InputSystem), ) // mouse .add_event::() @@ -61,7 +58,7 @@ impl Plugin for InputPlugin { .init_resource::>() .add_system_to_stage( CoreStage::PreUpdate, - mouse_button_input_system.system().label(InputSystem), + mouse_button_input_system.label(InputSystem), ) // gamepad .add_event::() @@ -72,14 +69,14 @@ impl Plugin for InputPlugin { .init_resource::>() .add_system_to_stage( CoreStage::PreUpdate, - gamepad_event_system.system().label(InputSystem), + gamepad_event_system.label(InputSystem), ) // touch .add_event::() .init_resource::() .add_system_to_stage( CoreStage::PreUpdate, - touch_screen_input_system.system().label(InputSystem), + touch_screen_input_system.label(InputSystem), ); } } diff --git a/crates/bevy_pbr/src/lib.rs b/crates/bevy_pbr/src/lib.rs index 0b24219d65..a99bb80513 100644 --- a/crates/bevy_pbr/src/lib.rs +++ b/crates/bevy_pbr/src/lib.rs @@ -19,7 +19,6 @@ pub mod prelude { use bevy_app::prelude::*; use bevy_asset::{AddAsset, Assets, Handle}; -use bevy_ecs::system::IntoSystem; use bevy_render::{prelude::Color, shader}; use material::StandardMaterial; use render_graph::add_pbr_graph; @@ -34,7 +33,7 @@ impl Plugin for PbrPlugin { .register_type::() .add_system_to_stage( CoreStage::PostUpdate, - shader::asset_shader_defs_system::.system(), + shader::asset_shader_defs_system::, ) .init_resource::(); add_pbr_graph(&mut app.world); diff --git a/crates/bevy_pbr/src/render_graph/lights_node.rs b/crates/bevy_pbr/src/render_graph/lights_node.rs index 6c7f0bbc96..147e830a7a 100644 --- a/crates/bevy_pbr/src/render_graph/lights_node.rs +++ b/crates/bevy_pbr/src/render_graph/lights_node.rs @@ -6,7 +6,7 @@ use crate::{ }; use bevy_core::{bytes_of, Pod, Zeroable}; use bevy_ecs::{ - system::{BoxedSystem, IntoSystem, Local, Query, Res, ResMut}, + system::{BoxedSystem, ConfigurableSystem, Local, Query, Res, ResMut}, world::World, }; use bevy_render::{ @@ -59,7 +59,7 @@ struct LightCount { impl SystemNode for LightsNode { fn get_system(&self) -> BoxedSystem { - let system = lights_node_system.system().config(|config| { + let system = lights_node_system.config(|config| { config.0 = Some(LightsNodeSystemState { command_queue: self.command_queue.clone(), max_point_lights: self.max_point_lights, diff --git a/crates/bevy_render/src/lib.rs b/crates/bevy_render/src/lib.rs index 2ff192eeb6..e26be98280 100644 --- a/crates/bevy_render/src/lib.rs +++ b/crates/bevy_render/src/lib.rs @@ -14,7 +14,7 @@ pub mod wireframe; use bevy_ecs::{ schedule::{ParallelSystemDescriptorCoercion, SystemStage}, - system::{IntoExclusiveSystem, IntoSystem, Res}, + system::{IntoExclusiveSystem, Res}, }; use bevy_transform::TransformSystem; use bevy_utils::tracing::warn; @@ -174,58 +174,38 @@ impl Plugin for RenderPlugin { .init_resource::() .init_resource::() .init_resource::() - .add_startup_system_to_stage( - StartupStage::PreStartup, - check_for_render_resource_context.system(), - ) - .add_system_to_stage(CoreStage::PreUpdate, draw::clear_draw_system.system()) + .add_startup_system_to_stage(StartupStage::PreStartup, check_for_render_resource_context) + .add_system_to_stage(CoreStage::PreUpdate, draw::clear_draw_system) + .add_system_to_stage(CoreStage::PostUpdate, camera::active_cameras_system) .add_system_to_stage( CoreStage::PostUpdate, - camera::active_cameras_system.system(), + camera::camera_system::.before(RenderSystem::VisibleEntities), ) .add_system_to_stage( CoreStage::PostUpdate, - camera::camera_system:: - .system() - .before(RenderSystem::VisibleEntities), - ) - .add_system_to_stage( - CoreStage::PostUpdate, - camera::camera_system:: - .system() - .before(RenderSystem::VisibleEntities), + camera::camera_system::.before(RenderSystem::VisibleEntities), ) .add_system_to_stage( CoreStage::PostUpdate, camera::visible_entities_system - .system() .label(RenderSystem::VisibleEntities) .after(TransformSystem::TransformPropagate), ) + .add_system_to_stage(RenderStage::RenderResource, shader::shader_update_system) .add_system_to_stage( RenderStage::RenderResource, - shader::shader_update_system.system(), + mesh::mesh_resource_provider_system, ) .add_system_to_stage( RenderStage::RenderResource, - mesh::mesh_resource_provider_system.system(), - ) - .add_system_to_stage( - RenderStage::RenderResource, - Texture::texture_resource_system.system(), + Texture::texture_resource_system, ) .add_system_to_stage( RenderStage::RenderGraphSystems, render_graph::render_graph_schedule_executor_system.exclusive_system(), ) - .add_system_to_stage( - RenderStage::Draw, - pipeline::draw_render_pipelines_system.system(), - ) - .add_system_to_stage( - RenderStage::PostRender, - shader::clear_shader_defs_system.system(), - ); + .add_system_to_stage(RenderStage::Draw, pipeline::draw_render_pipelines_system) + .add_system_to_stage(RenderStage::PostRender, shader::clear_shader_defs_system); if let Some(ref config) = self.base_render_graph_config { crate::base::add_base_graph(config, &mut app.world); diff --git a/crates/bevy_render/src/render_graph/nodes/camera_node.rs b/crates/bevy_render/src/render_graph/nodes/camera_node.rs index c2cc678863..3d6f72e452 100644 --- a/crates/bevy_render/src/render_graph/nodes/camera_node.rs +++ b/crates/bevy_render/src/render_graph/nodes/camera_node.rs @@ -8,7 +8,7 @@ use crate::{ }; use bevy_core::bytes_of; use bevy_ecs::{ - system::{BoxedSystem, IntoSystem, Local, Query, Res, ResMut}, + system::{BoxedSystem, ConfigurableSystem, Local, Query, Res, ResMut}, world::World, }; use bevy_transform::prelude::*; @@ -46,7 +46,7 @@ impl Node for CameraNode { impl SystemNode for CameraNode { fn get_system(&self) -> BoxedSystem { - let system = camera_node_system.system().config(|config| { + let system = camera_node_system.config(|config| { config.0 = Some(CameraNodeState { camera_name: self.camera_name.clone(), command_queue: self.command_queue.clone(), diff --git a/crates/bevy_render/src/render_graph/nodes/render_resources_node.rs b/crates/bevy_render/src/render_graph/nodes/render_resources_node.rs index 0901a7782d..eb4476e329 100644 --- a/crates/bevy_render/src/render_graph/nodes/render_resources_node.rs +++ b/crates/bevy_render/src/render_graph/nodes/render_resources_node.rs @@ -14,7 +14,9 @@ use bevy_asset::{Asset, AssetEvent, Assets, Handle, HandleId}; use bevy_ecs::{ entity::Entity, query::{Changed, Or, With}, - system::{BoxedSystem, IntoSystem, Local, Query, QuerySet, RemovedComponents, Res, ResMut}, + system::{ + BoxedSystem, ConfigurableSystem, Local, Query, QuerySet, RemovedComponents, Res, ResMut, + }, world::World, }; use bevy_utils::HashMap; @@ -400,7 +402,7 @@ where T: renderer::RenderResources, { fn get_system(&self) -> BoxedSystem { - let system = render_resources_node_system::.system().config(|config| { + let system = render_resources_node_system::.config(|config| { config.0 = Some(RenderResourcesNodeState { command_queue: self.command_queue.clone(), uniform_buffer_arrays: UniformBufferArrays::::default(), @@ -583,15 +585,13 @@ where T: renderer::RenderResources + Asset, { fn get_system(&self) -> BoxedSystem { - let system = asset_render_resources_node_system:: - .system() - .config(|config| { - config.0 = Some(RenderResourcesNodeState { - command_queue: self.command_queue.clone(), - uniform_buffer_arrays: UniformBufferArrays::::default(), - dynamic_uniforms: self.dynamic_uniforms, - }) - }); + let system = asset_render_resources_node_system::.config(|config| { + config.0 = Some(RenderResourcesNodeState { + command_queue: self.command_queue.clone(), + uniform_buffer_arrays: UniformBufferArrays::::default(), + dynamic_uniforms: self.dynamic_uniforms, + }) + }); Box::new(system) } diff --git a/crates/bevy_render/src/wireframe/mod.rs b/crates/bevy_render/src/wireframe/mod.rs index c6b918540d..d98eb165ab 100644 --- a/crates/bevy_render/src/wireframe/mod.rs +++ b/crates/bevy_render/src/wireframe/mod.rs @@ -10,7 +10,7 @@ use bevy_asset::{Assets, Handle, HandleUntyped}; use bevy_ecs::{ query::With, reflect::ReflectComponent, - system::{IntoSystem, Query, QuerySet, Res}, + system::{Query, QuerySet, Res}, world::Mut, }; use bevy_reflect::{Reflect, TypeUuid}; @@ -27,7 +27,7 @@ pub struct WireframePlugin; impl Plugin for WireframePlugin { fn build(&self, app: &mut App) { app.init_resource::() - .add_system_to_stage(crate::RenderStage::Draw, draw_wireframes_system.system()); + .add_system_to_stage(crate::RenderStage::Draw, draw_wireframes_system); let world = app.world.cell(); let mut shaders = world.get_resource_mut::>().unwrap(); let mut pipelines = world diff --git a/crates/bevy_sprite/src/lib.rs b/crates/bevy_sprite/src/lib.rs index 3dd0b5390b..4dfdb78849 100644 --- a/crates/bevy_sprite/src/lib.rs +++ b/crates/bevy_sprite/src/lib.rs @@ -28,10 +28,7 @@ pub use texture_atlas_builder::*; use bevy_app::prelude::*; use bevy_asset::{AddAsset, Assets, Handle, HandleUntyped}; -use bevy_ecs::{ - component::{ComponentDescriptor, StorageType}, - system::IntoSystem, -}; +use bevy_ecs::component::{ComponentDescriptor, StorageType}; use bevy_math::Vec2; use bevy_reflect::TypeUuid; use bevy_render::{ @@ -72,14 +69,11 @@ impl Plugin for SpritePlugin { .add_asset::() .register_type::() .register_type::() - .add_system_to_stage(CoreStage::PostUpdate, sprite_system.system()) + .add_system_to_stage(CoreStage::PostUpdate, sprite_system) + .add_system_to_stage(CoreStage::PostUpdate, material_texture_detection_system) .add_system_to_stage( CoreStage::PostUpdate, - material_texture_detection_system.system(), - ) - .add_system_to_stage( - CoreStage::PostUpdate, - asset_shader_defs_system::.system(), + asset_shader_defs_system::, ); let sprite_settings = app @@ -89,11 +83,11 @@ impl Plugin for SpritePlugin { if sprite_settings.frustum_culling_enabled { app.add_system_to_stage( CoreStage::PostUpdate, - frustum_culling::sprite_frustum_culling_system.system(), + frustum_culling::sprite_frustum_culling_system, ) .add_system_to_stage( CoreStage::PostUpdate, - frustum_culling::atlas_frustum_culling_system.system(), + frustum_culling::atlas_frustum_culling_system, ); } app.world diff --git a/crates/bevy_text/src/lib.rs b/crates/bevy_text/src/lib.rs index f69ffb4a29..ce91d4a2e8 100644 --- a/crates/bevy_text/src/lib.rs +++ b/crates/bevy_text/src/lib.rs @@ -29,7 +29,7 @@ pub mod prelude { use bevy_app::prelude::*; use bevy_asset::AddAsset; -use bevy_ecs::{entity::Entity, system::IntoSystem}; +use bevy_ecs::entity::Entity; use bevy_render::RenderStage; pub type DefaultTextPipeline = TextPipeline; @@ -43,7 +43,7 @@ impl Plugin for TextPlugin { .add_asset::() .init_asset_loader::() .insert_resource(DefaultTextPipeline::default()) - .add_system_to_stage(CoreStage::PostUpdate, text2d_system.system()) - .add_system_to_stage(RenderStage::Draw, text2d::draw_text2d_system.system()); + .add_system_to_stage(CoreStage::PostUpdate, text2d_system) + .add_system_to_stage(RenderStage::Draw, text2d::draw_text2d_system); } } diff --git a/crates/bevy_transform/src/hierarchy/hierarchy_maintenance_system.rs b/crates/bevy_transform/src/hierarchy/hierarchy_maintenance_system.rs index 541b10744b..3f7491f659 100644 --- a/crates/bevy_transform/src/hierarchy/hierarchy_maintenance_system.rs +++ b/crates/bevy_transform/src/hierarchy/hierarchy_maintenance_system.rs @@ -75,7 +75,7 @@ pub fn parent_update_system( mod test { use bevy_ecs::{ schedule::{Schedule, Stage, SystemStage}, - system::{CommandQueue, IntoSystem}, + system::CommandQueue, world::World, }; @@ -87,8 +87,8 @@ mod test { let mut world = World::default(); let mut update_stage = SystemStage::parallel(); - update_stage.add_system(parent_update_system.system()); - update_stage.add_system(transform_propagate_system.system()); + update_stage.add_system(parent_update_system); + update_stage.add_system(transform_propagate_system); let mut schedule = Schedule::default(); schedule.add_stage("update", update_stage); diff --git a/crates/bevy_transform/src/lib.rs b/crates/bevy_transform/src/lib.rs index 6dfcc81754..f255c613db 100644 --- a/crates/bevy_transform/src/lib.rs +++ b/crates/bevy_transform/src/lib.rs @@ -8,10 +8,7 @@ pub mod prelude { } use bevy_app::prelude::*; -use bevy_ecs::{ - schedule::{ParallelSystemDescriptorCoercion, SystemLabel}, - system::IntoSystem, -}; +use bevy_ecs::schedule::{ParallelSystemDescriptorCoercion, SystemLabel}; use prelude::{parent_update_system, Children, GlobalTransform, Parent, PreviousParent, Transform}; #[derive(Default)] @@ -33,27 +30,21 @@ impl Plugin for TransformPlugin { // add transform systems to startup so the first update is "correct" .add_startup_system_to_stage( StartupStage::PostStartup, - parent_update_system - .system() - .label(TransformSystem::ParentUpdate), + parent_update_system.label(TransformSystem::ParentUpdate), ) .add_startup_system_to_stage( StartupStage::PostStartup, transform_propagate_system::transform_propagate_system - .system() .label(TransformSystem::TransformPropagate) .after(TransformSystem::ParentUpdate), ) .add_system_to_stage( CoreStage::PostUpdate, - parent_update_system - .system() - .label(TransformSystem::ParentUpdate), + parent_update_system.label(TransformSystem::ParentUpdate), ) .add_system_to_stage( CoreStage::PostUpdate, transform_propagate_system::transform_propagate_system - .system() .label(TransformSystem::TransformPropagate) .after(TransformSystem::ParentUpdate), ); diff --git a/crates/bevy_transform/src/transform_propagate_system.rs b/crates/bevy_transform/src/transform_propagate_system.rs index 0c74d2579c..a4ab7aadcd 100644 --- a/crates/bevy_transform/src/transform_propagate_system.rs +++ b/crates/bevy_transform/src/transform_propagate_system.rs @@ -77,7 +77,7 @@ fn propagate_recursive( mod test { use bevy_ecs::{ schedule::{Schedule, Stage, SystemStage}, - system::{CommandQueue, Commands, IntoSystem}, + system::{CommandQueue, Commands}, world::World, }; @@ -89,8 +89,8 @@ mod test { let mut world = World::default(); let mut update_stage = SystemStage::parallel(); - update_stage.add_system(parent_update_system.system()); - update_stage.add_system(transform_propagate_system.system()); + update_stage.add_system(parent_update_system); + update_stage.add_system(transform_propagate_system); let mut schedule = Schedule::default(); schedule.add_stage("update", update_stage); @@ -144,8 +144,8 @@ mod test { let mut world = World::default(); let mut update_stage = SystemStage::parallel(); - update_stage.add_system(parent_update_system.system()); - update_stage.add_system(transform_propagate_system.system()); + update_stage.add_system(parent_update_system); + update_stage.add_system(transform_propagate_system); let mut schedule = Schedule::default(); schedule.add_stage("update", update_stage); diff --git a/crates/bevy_ui/src/lib.rs b/crates/bevy_ui/src/lib.rs index 862aa66e17..e9ca5b3b32 100644 --- a/crates/bevy_ui/src/lib.rs +++ b/crates/bevy_ui/src/lib.rs @@ -22,10 +22,7 @@ pub mod prelude { } use bevy_app::prelude::*; -use bevy_ecs::{ - schedule::{ParallelSystemDescriptorCoercion, SystemLabel}, - system::IntoSystem, -}; +use bevy_ecs::schedule::{ParallelSystemDescriptorCoercion, SystemLabel}; use bevy_input::InputSystem; use bevy_math::{Rect, Size}; use bevy_render::RenderStage; @@ -62,35 +59,30 @@ impl Plugin for UiPlugin { .register_type::() .add_system_to_stage( CoreStage::PreUpdate, - ui_focus_system - .system() - .label(UiSystem::Focus) - .after(InputSystem), + ui_focus_system.label(UiSystem::Focus).after(InputSystem), ) // add these stages to front because these must run before transform update systems .add_system_to_stage( CoreStage::PostUpdate, - widget::text_system.system().before(UiSystem::Flex), + widget::text_system.before(UiSystem::Flex), ) .add_system_to_stage( CoreStage::PostUpdate, - widget::image_node_system.system().before(UiSystem::Flex), + widget::image_node_system.before(UiSystem::Flex), ) .add_system_to_stage( CoreStage::PostUpdate, flex_node_system - .system() .label(UiSystem::Flex) .before(TransformSystem::TransformPropagate), ) .add_system_to_stage( CoreStage::PostUpdate, ui_z_system - .system() .after(UiSystem::Flex) .before(TransformSystem::TransformPropagate), ) - .add_system_to_stage(RenderStage::Draw, widget::draw_text_system.system()); + .add_system_to_stage(RenderStage::Draw, widget::draw_text_system); crate::render::add_ui_graph(&mut app.world); } diff --git a/crates/bevy_ui/src/update.rs b/crates/bevy_ui/src/update.rs index fd3fe3690e..42876a7c30 100644 --- a/crates/bevy_ui/src/update.rs +++ b/crates/bevy_ui/src/update.rs @@ -54,7 +54,7 @@ fn update_hierarchy( mod tests { use bevy_ecs::{ schedule::{Schedule, Stage, SystemStage}, - system::{CommandQueue, Commands, IntoSystem}, + system::{CommandQueue, Commands}, world::World, }; use bevy_transform::{components::Transform, hierarchy::BuildChildren}; @@ -122,7 +122,7 @@ mod tests { let mut schedule = Schedule::default(); let mut update_stage = SystemStage::parallel(); - update_stage.add_system(ui_z_system.system()); + update_stage.add_system(ui_z_system); schedule.add_stage("update", update_stage); schedule.run(&mut world); diff --git a/crates/bevy_wgpu/src/diagnostic/wgpu_resource_diagnostics_plugin.rs b/crates/bevy_wgpu/src/diagnostic/wgpu_resource_diagnostics_plugin.rs index 8dc74d543a..b696b7bbc0 100644 --- a/crates/bevy_wgpu/src/diagnostic/wgpu_resource_diagnostics_plugin.rs +++ b/crates/bevy_wgpu/src/diagnostic/wgpu_resource_diagnostics_plugin.rs @@ -1,7 +1,7 @@ use crate::renderer::WgpuRenderResourceContext; use bevy_app::prelude::*; use bevy_diagnostic::{Diagnostic, DiagnosticId, Diagnostics}; -use bevy_ecs::system::{IntoSystem, Res, ResMut}; +use bevy_ecs::system::{Res, ResMut}; use bevy_render::renderer::RenderResourceContext; #[derive(Default)] @@ -9,8 +9,8 @@ pub struct WgpuResourceDiagnosticsPlugin; impl Plugin for WgpuResourceDiagnosticsPlugin { fn build(&self, app: &mut App) { - app.add_startup_system(Self::setup_system.system()) - .add_system(Self::diagnostic_system.system()); + app.add_startup_system(Self::setup_system) + .add_system(Self::diagnostic_system); } } diff --git a/crates/bevy_wgpu/src/lib.rs b/crates/bevy_wgpu/src/lib.rs index 75d2567d0c..0adb26dc06 100644 --- a/crates/bevy_wgpu/src/lib.rs +++ b/crates/bevy_wgpu/src/lib.rs @@ -10,10 +10,7 @@ pub use wgpu_renderer::*; pub use wgpu_resources::*; use bevy_app::prelude::*; -use bevy_ecs::{ - system::{IntoExclusiveSystem, IntoSystem}, - world::World, -}; +use bevy_ecs::{system::IntoExclusiveSystem, world::World}; use bevy_render::{ renderer::{shared_buffers_update_system, RenderResourceContext, SharedBuffers}, RenderStage, @@ -107,10 +104,7 @@ impl Plugin for WgpuPlugin { fn build(&self, app: &mut App) { let render_system = get_wgpu_render_system(&mut app.world); app.add_system_to_stage(RenderStage::Render, render_system.exclusive_system()) - .add_system_to_stage( - RenderStage::PostRender, - shared_buffers_update_system.system(), - ); + .add_system_to_stage(RenderStage::PostRender, shared_buffers_update_system); } } diff --git a/crates/bevy_window/src/lib.rs b/crates/bevy_window/src/lib.rs index 02aaa3bfa1..79299dd9d0 100644 --- a/crates/bevy_window/src/lib.rs +++ b/crates/bevy_window/src/lib.rs @@ -3,7 +3,6 @@ mod system; mod window; mod windows; -use bevy_ecs::system::IntoSystem; pub use event::*; pub use system::*; pub use window::*; @@ -68,7 +67,7 @@ impl Plugin for WindowPlugin { } if self.exit_on_close { - app.add_system(exit_on_window_close_system.system()); + app.add_system(exit_on_window_close_system); } } } diff --git a/examples/2d/many_sprites.rs b/examples/2d/many_sprites.rs index 32e52a24cf..203efe3764 100644 --- a/examples/2d/many_sprites.rs +++ b/examples/2d/many_sprites.rs @@ -24,8 +24,8 @@ fn main() { }) .add_plugins(DefaultPlugins) .add_startup_system(setup) - .add_system(tick.system().label("Tick")) - .add_system(move_camera.system().after("Tick")) + .add_system(tick.label("Tick")) + .add_system(move_camera.after("Tick")) .run() } diff --git a/examples/3d/3d_scene.rs b/examples/3d/3d_scene.rs index e328190ba1..7bbe026d2b 100644 --- a/examples/3d/3d_scene.rs +++ b/examples/3d/3d_scene.rs @@ -4,7 +4,7 @@ fn main() { App::new() .insert_resource(Msaa { samples: 4 }) .add_plugins(DefaultPlugins) - .add_startup_system(setup.system()) + .add_startup_system(setup) .run(); } diff --git a/examples/3d/load_gltf.rs b/examples/3d/load_gltf.rs index 27ea98d304..280c8172bc 100644 --- a/examples/3d/load_gltf.rs +++ b/examples/3d/load_gltf.rs @@ -8,8 +8,8 @@ fn main() { }) .insert_resource(Msaa { samples: 4 }) .add_plugins(DefaultPlugins) - .add_startup_system(setup.system()) - .add_system(rotator_system.system()) + .add_startup_system(setup) + .add_system(rotator_system) .run(); } diff --git a/examples/3d/msaa.rs b/examples/3d/msaa.rs index fb153e2992..8878da9f02 100644 --- a/examples/3d/msaa.rs +++ b/examples/3d/msaa.rs @@ -8,7 +8,7 @@ fn main() { App::new() .insert_resource(Msaa { samples: 4 }) .add_plugins(DefaultPlugins) - .add_startup_system(setup.system()) + .add_startup_system(setup) .run(); } diff --git a/examples/3d/orthographic.rs b/examples/3d/orthographic.rs index 4da52ee86b..ec8a1d296b 100644 --- a/examples/3d/orthographic.rs +++ b/examples/3d/orthographic.rs @@ -4,7 +4,7 @@ fn main() { App::new() .insert_resource(Msaa { samples: 4 }) .add_plugins(DefaultPlugins) - .add_startup_system(setup.system()) + .add_startup_system(setup) .run(); } diff --git a/examples/3d/parenting.rs b/examples/3d/parenting.rs index 129c2188f8..4d54464a8c 100644 --- a/examples/3d/parenting.rs +++ b/examples/3d/parenting.rs @@ -6,8 +6,8 @@ fn main() { App::new() .insert_resource(Msaa { samples: 4 }) .add_plugins(DefaultPlugins) - .add_startup_system(setup.system()) - .add_system(rotator_system.system()) + .add_startup_system(setup) + .add_system(rotator_system) .run(); } diff --git a/examples/3d/pbr.rs b/examples/3d/pbr.rs index adfd966f98..0bd93545aa 100644 --- a/examples/3d/pbr.rs +++ b/examples/3d/pbr.rs @@ -5,7 +5,7 @@ fn main() { App::new() .insert_resource(Msaa { samples: 4 }) .add_plugins(DefaultPlugins) - .add_startup_system(setup.system()) + .add_startup_system(setup) .run(); } diff --git a/examples/3d/render_to_texture.rs b/examples/3d/render_to_texture.rs index af70fe962a..1cb34f27fa 100644 --- a/examples/3d/render_to_texture.rs +++ b/examples/3d/render_to_texture.rs @@ -226,8 +226,8 @@ fn setup( fn main() { let mut app = App::new(); app.add_plugins(DefaultPlugins) - .add_startup_system(setup.system()) - .add_system(cube_rotator_system.system()) - .add_system(rotator_system.system()) + .add_startup_system(setup) + .add_system(cube_rotator_system) + .add_system(rotator_system) .run(); } diff --git a/examples/3d/spawner.rs b/examples/3d/spawner.rs index 50d4a8fdfc..60e52d163d 100644 --- a/examples/3d/spawner.rs +++ b/examples/3d/spawner.rs @@ -17,8 +17,8 @@ fn main() { .add_plugins(DefaultPlugins) .add_plugin(FrameTimeDiagnosticsPlugin::default()) .add_plugin(LogDiagnosticsPlugin::default()) - .add_startup_system(setup.system()) - .add_system(move_cubes.system()) + .add_startup_system(setup) + .add_system(move_cubes) .run(); } diff --git a/examples/3d/texture.rs b/examples/3d/texture.rs index 934c35205d..75e5f1f9cc 100644 --- a/examples/3d/texture.rs +++ b/examples/3d/texture.rs @@ -4,7 +4,7 @@ use bevy::prelude::*; fn main() { App::new() .add_plugins(DefaultPlugins) - .add_startup_system(setup.system()) + .add_startup_system(setup) .run(); } diff --git a/examples/3d/update_gltf_scene.rs b/examples/3d/update_gltf_scene.rs index 5cd93441b8..15a84a4919 100644 --- a/examples/3d/update_gltf_scene.rs +++ b/examples/3d/update_gltf_scene.rs @@ -5,9 +5,9 @@ fn main() { .insert_resource(Msaa { samples: 4 }) .add_plugins(DefaultPlugins) .insert_resource(SceneInstance::default()) - .add_startup_system(setup.system()) - .add_system(scene_update.system()) - .add_system(move_scene_entities.system()) + .add_startup_system(setup) + .add_system(scene_update) + .add_system(move_scene_entities) .run(); } diff --git a/examples/3d/wireframe.rs b/examples/3d/wireframe.rs index 6901f14512..c07483cfb2 100644 --- a/examples/3d/wireframe.rs +++ b/examples/3d/wireframe.rs @@ -16,7 +16,7 @@ fn main() { }) .add_plugins(DefaultPlugins) .add_plugin(WireframePlugin) - .add_startup_system(setup.system()) + .add_startup_system(setup) .run(); } diff --git a/examples/3d/z_sort_debug.rs b/examples/3d/z_sort_debug.rs index 3ebdfcda1d..6484fda893 100644 --- a/examples/3d/z_sort_debug.rs +++ b/examples/3d/z_sort_debug.rs @@ -11,9 +11,9 @@ use bevy::{ fn main() { App::new() .add_plugins(DefaultPlugins) - .add_startup_system(setup.system()) - .add_system(rotator_system.system()) - .add_system(camera_order_color_system.system()) + .add_startup_system(setup) + .add_system(rotator_system) + .add_system(camera_order_color_system) .run(); } diff --git a/examples/android/android.rs b/examples/android/android.rs index 6e3c6f6962..006dd37486 100644 --- a/examples/android/android.rs +++ b/examples/android/android.rs @@ -6,7 +6,7 @@ fn main() { App::new() .insert_resource(Msaa { samples: 2 }) .add_plugins(DefaultPlugins) - .add_startup_system(setup.system()) + .add_startup_system(setup) .run(); } diff --git a/examples/app/custom_loop.rs b/examples/app/custom_loop.rs index 5a191781ad..c422fc2c8f 100644 --- a/examples/app/custom_loop.rs +++ b/examples/app/custom_loop.rs @@ -24,6 +24,6 @@ fn main() { App::new() .insert_resource(Input(String::new())) .set_runner(my_runner) - .add_system(print_system.system()) + .add_system(print_system) .run(); } diff --git a/examples/app/drag_and_drop.rs b/examples/app/drag_and_drop.rs index d3f0e54c71..3615aab7eb 100644 --- a/examples/app/drag_and_drop.rs +++ b/examples/app/drag_and_drop.rs @@ -3,7 +3,7 @@ use bevy::prelude::*; fn main() { App::new() .add_plugins(DefaultPlugins) - .add_system(file_drag_and_drop_system.system()) + .add_system(file_drag_and_drop_system) .run(); } diff --git a/examples/app/headless.rs b/examples/app/headless.rs index c89f8fea14..4dbbcda903 100644 --- a/examples/app/headless.rs +++ b/examples/app/headless.rs @@ -13,7 +13,7 @@ fn main() { App::new() .insert_resource(ScheduleRunnerSettings::run_once()) .add_plugins(MinimalPlugins) - .add_system(hello_world_system.system()) + .add_system(hello_world_system) .run(); // this app loops forever at 60 fps @@ -22,7 +22,7 @@ fn main() { 1.0 / 60.0, ))) .add_plugins(MinimalPlugins) - .add_system(counter.system()) + .add_system(counter) .run(); } diff --git a/examples/app/logs.rs b/examples/app/logs.rs index 6b0a5c7aba..cdc6b5db01 100644 --- a/examples/app/logs.rs +++ b/examples/app/logs.rs @@ -9,7 +9,7 @@ fn main() { // filter: "wgpu=warn,bevy_ecs=info".to_string(), // }) .add_plugins(DefaultPlugins) - .add_system(log_system.system()) + .add_system(log_system) .run(); } diff --git a/examples/app/plugin.rs b/examples/app/plugin.rs index 6248b3aee8..93600d943f 100644 --- a/examples/app/plugin.rs +++ b/examples/app/plugin.rs @@ -28,8 +28,7 @@ impl Plugin for PrintMessagePlugin { message: self.message.clone(), timer: Timer::new(self.wait_duration, true), }; - app.insert_resource(state) - .add_system(print_message_system.system()); + app.insert_resource(state).add_system(print_message_system); } } diff --git a/examples/app/plugin_group.rs b/examples/app/plugin_group.rs index 0e258105fc..8980c3341b 100644 --- a/examples/app/plugin_group.rs +++ b/examples/app/plugin_group.rs @@ -29,7 +29,7 @@ pub struct PrintHelloPlugin; impl Plugin for PrintHelloPlugin { fn build(&self, app: &mut App) { - app.add_system(print_hello_system.system()); + app.add_system(print_hello_system); } } @@ -41,7 +41,7 @@ pub struct PrintWorldPlugin; impl Plugin for PrintWorldPlugin { fn build(&self, app: &mut App) { - app.add_system(print_world_system.system()); + app.add_system(print_world_system); } } diff --git a/examples/app/return_after_run.rs b/examples/app/return_after_run.rs index ced46257d0..5fe9b2b87b 100644 --- a/examples/app/return_after_run.rs +++ b/examples/app/return_after_run.rs @@ -8,7 +8,7 @@ fn main() { }) .insert_resource(ClearColor(Color::rgb(0.2, 0.2, 0.8))) .add_plugins(DefaultPlugins) - .add_system(system1.system()) + .add_system(system1) .run(); println!("Running another App."); App::new() @@ -19,7 +19,7 @@ fn main() { .add_plugins_with(DefaultPlugins, |group| { group.disable::() }) - .add_system(system2.system()) + .add_system(system2) .run(); println!("Done."); } diff --git a/examples/asset/asset_loading.rs b/examples/asset/asset_loading.rs index f383e0b9fc..4c0f6b926d 100644 --- a/examples/asset/asset_loading.rs +++ b/examples/asset/asset_loading.rs @@ -5,7 +5,7 @@ fn main() { App::new() .insert_resource(Msaa { samples: 4 }) .add_plugins(DefaultPlugins) - .add_startup_system(setup.system()) + .add_startup_system(setup) .run(); } diff --git a/examples/asset/custom_asset.rs b/examples/asset/custom_asset.rs index d04c104e2e..820d62394e 100644 --- a/examples/asset/custom_asset.rs +++ b/examples/asset/custom_asset.rs @@ -39,8 +39,8 @@ fn main() { .init_resource::() .add_asset::() .init_asset_loader::() - .add_startup_system(setup.system()) - .add_system(print_on_load.system()) + .add_startup_system(setup) + .add_system(print_on_load) .run(); } diff --git a/examples/asset/custom_asset_io.rs b/examples/asset/custom_asset_io.rs index 9a18fee7ee..718cbc1047 100644 --- a/examples/asset/custom_asset_io.rs +++ b/examples/asset/custom_asset_io.rs @@ -85,7 +85,7 @@ fn main() { // asset system are initialized correctly. group.add_before::(CustomAssetIoPlugin) }) - .add_startup_system(setup.system()) + .add_startup_system(setup) .run(); } diff --git a/examples/asset/hot_asset_reloading.rs b/examples/asset/hot_asset_reloading.rs index 82d5d50194..9216b10311 100644 --- a/examples/asset/hot_asset_reloading.rs +++ b/examples/asset/hot_asset_reloading.rs @@ -6,7 +6,7 @@ use bevy::prelude::*; fn main() { App::new() .add_plugins(DefaultPlugins) - .add_startup_system(setup.system()) + .add_startup_system(setup) .run(); } diff --git a/examples/async_tasks/async_compute.rs b/examples/async_tasks/async_compute.rs index e8c316a3de..9e0b50b05a 100644 --- a/examples/async_tasks/async_compute.rs +++ b/examples/async_tasks/async_compute.rs @@ -12,10 +12,10 @@ fn main() { App::new() .insert_resource(Msaa { samples: 4 }) .add_plugins(DefaultPlugins) - .add_startup_system(setup_env.system()) - .add_startup_system(add_assets.system()) - .add_startup_system(spawn_tasks.system()) - .add_system(handle_tasks.system()) + .add_startup_system(setup_env) + .add_startup_system(add_assets) + .add_startup_system(spawn_tasks) + .add_system(handle_tasks) .run(); } diff --git a/examples/audio/audio.rs b/examples/audio/audio.rs index 517d66d79a..b093b88d94 100644 --- a/examples/audio/audio.rs +++ b/examples/audio/audio.rs @@ -4,7 +4,7 @@ use bevy::prelude::*; fn main() { App::new() .add_plugins(DefaultPlugins) - .add_startup_system(setup.system()) + .add_startup_system(setup) .run(); } diff --git a/examples/diagnostics/custom_diagnostic.rs b/examples/diagnostics/custom_diagnostic.rs index 83a53629e9..7f289d9f5b 100644 --- a/examples/diagnostics/custom_diagnostic.rs +++ b/examples/diagnostics/custom_diagnostic.rs @@ -10,8 +10,8 @@ fn main() { // The "print diagnostics" plugin is optional. It just visualizes our diagnostics in the // console .add_plugin(LogDiagnosticsPlugin::default()) - .add_startup_system(setup_diagnostic_system.system()) - .add_system(my_system.system()) + .add_startup_system(setup_diagnostic_system) + .add_system(my_system) .run(); } diff --git a/examples/ecs/component_change_detection.rs b/examples/ecs/component_change_detection.rs index 09b7ca2a86..7ece27bebc 100644 --- a/examples/ecs/component_change_detection.rs +++ b/examples/ecs/component_change_detection.rs @@ -5,10 +5,10 @@ use rand::Rng; fn main() { App::new() .add_plugins(DefaultPlugins) - .add_startup_system(setup.system()) - .add_system(change_component.system()) - .add_system(change_detection.system()) - .add_system(tracker_monitoring.system()) + .add_startup_system(setup) + .add_system(change_component) + .add_system(change_detection) + .add_system(tracker_monitoring) .run(); } diff --git a/examples/ecs/event.rs b/examples/ecs/event.rs index 878a7074d9..cc913f45f2 100644 --- a/examples/ecs/event.rs +++ b/examples/ecs/event.rs @@ -7,8 +7,8 @@ fn main() { .add_plugins(DefaultPlugins) .add_event::() .init_resource::() - .add_system(event_trigger_system.system()) - .add_system(event_listener_system.system()) + .add_system(event_trigger_system) + .add_system(event_listener_system) .run(); } diff --git a/examples/ecs/fixed_timestep.rs b/examples/ecs/fixed_timestep.rs index 6fe66945af..f89d304668 100644 --- a/examples/ecs/fixed_timestep.rs +++ b/examples/ecs/fixed_timestep.rs @@ -12,7 +12,7 @@ fn main() { App::new() .add_plugins(DefaultPlugins) // this system will run once every update (it should match your screen's refresh rate) - .add_system(frame_update.system()) + .add_system(frame_update) // add a new stage that runs twice a second .add_stage_after( CoreStage::Update, @@ -24,7 +24,7 @@ fn main() { // FixedTimestep state from within a system .with_label(LABEL), ) - .with_system(fixed_update.system()), + .with_system(fixed_update), ) .run(); } diff --git a/examples/ecs/hierarchy.rs b/examples/ecs/hierarchy.rs index a0b27b7ccd..96a51f72d0 100644 --- a/examples/ecs/hierarchy.rs +++ b/examples/ecs/hierarchy.rs @@ -3,8 +3,8 @@ use bevy::prelude::*; fn main() { App::new() .add_plugins(DefaultPlugins) - .add_startup_system(setup.system()) - .add_system(rotate.system()) + .add_startup_system(setup) + .add_system(rotate) .run(); } diff --git a/examples/ecs/iter_combinations.rs b/examples/ecs/iter_combinations.rs index 04bfbfe235..69e8811a6a 100644 --- a/examples/ecs/iter_combinations.rs +++ b/examples/ecs/iter_combinations.rs @@ -10,14 +10,14 @@ fn main() { App::new() .insert_resource(Msaa { samples: 4 }) .add_plugins(DefaultPlugins) - .add_startup_system(generate_bodies.system()) + .add_startup_system(generate_bodies) .add_stage_after( CoreStage::Update, FixedUpdateStage, SystemStage::parallel() .with_run_criteria(FixedTimestep::step(DELTA_TIME)) - .with_system(interact_bodies.system()) - .with_system(integrate.system()), + .with_system(interact_bodies) + .with_system(integrate), ) .run(); } diff --git a/examples/ecs/parallel_query.rs b/examples/ecs/parallel_query.rs index 98b89bf417..3c770f5d2b 100644 --- a/examples/ecs/parallel_query.rs +++ b/examples/ecs/parallel_query.rs @@ -70,8 +70,8 @@ fn bounce_system( fn main() { App::new() .add_plugins(DefaultPlugins) - .add_startup_system(spawn_system.system()) - .add_system(move_system.system()) - .add_system(bounce_system.system()) + .add_startup_system(spawn_system) + .add_system(move_system) + .add_system(bounce_system) .run(); } diff --git a/examples/ecs/query_bundle.rs b/examples/ecs/query_bundle.rs index e77f330922..8d9f158f8d 100644 --- a/examples/ecs/query_bundle.rs +++ b/examples/ecs/query_bundle.rs @@ -3,9 +3,9 @@ use bevy::{log::LogPlugin, prelude::*}; fn main() { App::new() .add_plugin(LogPlugin) - .add_startup_system(setup.system()) - .add_system(log_names.system().label(LogNamesSystem)) - .add_system(log_person_bundles.system().after(LogNamesSystem)) + .add_startup_system(setup) + .add_system(log_names.label(LogNamesSystem)) + .add_system(log_person_bundles.after(LogNamesSystem)) .run(); } diff --git a/examples/ecs/removal_detection.rs b/examples/ecs/removal_detection.rs index 26902dbd0c..de4275e348 100644 --- a/examples/ecs/removal_detection.rs +++ b/examples/ecs/removal_detection.rs @@ -15,9 +15,9 @@ fn main() { // `CoreStage::PostUpdate` stage. App::new() .add_plugins(DefaultPlugins) - .add_startup_system(setup.system()) - .add_system_to_stage(CoreStage::Update, remove_component.system()) - .add_system_to_stage(CoreStage::PostUpdate, react_on_removal.system()) + .add_startup_system(setup) + .add_system_to_stage(CoreStage::Update, remove_component) + .add_system_to_stage(CoreStage::PostUpdate, react_on_removal) .run(); } diff --git a/examples/ecs/startup_system.rs b/examples/ecs/startup_system.rs index b9c6a2f60e..82437b03af 100644 --- a/examples/ecs/startup_system.rs +++ b/examples/ecs/startup_system.rs @@ -2,8 +2,8 @@ use bevy::prelude::*; fn main() { App::new() - .add_startup_system(startup_system.system()) - .add_system(normal_system.system()) + .add_startup_system(startup_system) + .add_system(normal_system) .run(); } diff --git a/examples/ecs/state.rs b/examples/ecs/state.rs index eca1129310..061a324afe 100644 --- a/examples/ecs/state.rs +++ b/examples/ecs/state.rs @@ -7,14 +7,14 @@ fn main() { .add_plugins(DefaultPlugins) .init_resource::() .add_state(AppState::Menu) - .add_system_set(SystemSet::on_enter(AppState::Menu).with_system(setup_menu.system())) - .add_system_set(SystemSet::on_update(AppState::Menu).with_system(menu.system())) - .add_system_set(SystemSet::on_exit(AppState::Menu).with_system(cleanup_menu.system())) - .add_system_set(SystemSet::on_enter(AppState::InGame).with_system(setup_game.system())) + .add_system_set(SystemSet::on_enter(AppState::Menu).with_system(setup_menu)) + .add_system_set(SystemSet::on_update(AppState::Menu).with_system(menu)) + .add_system_set(SystemSet::on_exit(AppState::Menu).with_system(cleanup_menu)) + .add_system_set(SystemSet::on_enter(AppState::InGame).with_system(setup_game)) .add_system_set( SystemSet::on_update(AppState::InGame) - .with_system(movement.system()) - .with_system(change_color.system()), + .with_system(movement) + .with_system(change_color), ) .run(); } diff --git a/examples/ecs/system_chaining.rs b/examples/ecs/system_chaining.rs index ce93548069..afc46551ce 100644 --- a/examples/ecs/system_chaining.rs +++ b/examples/ecs/system_chaining.rs @@ -4,7 +4,7 @@ use bevy::prelude::*; fn main() { App::new() .insert_resource(Message("42".to_string())) - .add_system(parse_message_system.system().chain(handler_system.system())) + .add_system(parse_message_system.chain(handler_system)) .run(); } diff --git a/examples/ecs/system_param.rs b/examples/ecs/system_param.rs index 4fc6549888..12059e00d2 100644 --- a/examples/ecs/system_param.rs +++ b/examples/ecs/system_param.rs @@ -4,8 +4,8 @@ use bevy::{ecs::system::SystemParam, prelude::*}; fn main() { App::new() .insert_resource(PlayerCount(0)) - .add_startup_system(spawn.system()) - .add_system(count_players.system()) + .add_startup_system(spawn) + .add_system(count_players) .run(); } diff --git a/examples/ecs/system_sets.rs b/examples/ecs/system_sets.rs index fd89135dda..af496e5cc7 100644 --- a/examples/ecs/system_sets.rs +++ b/examples/ecs/system_sets.rs @@ -63,16 +63,14 @@ fn main() { .label(Physics) // This criteria ensures this whole system set only runs when this system's // output says so (ShouldRun::Yes) - .with_run_criteria(run_for_a_second.system()) + .with_run_criteria(run_for_a_second) .with_system( update_velocity - .system() // Only applied to the `update_velocity` system .label(PhysicsSystem::UpdateVelocity), ) .with_system( movement - .system() // Only applied to the `movement` system .label(PhysicsSystem::Movement) // Enforce order within this system by specifying this @@ -93,14 +91,13 @@ fn main() { .with_run_criteria(RunCriteria::pipe("is_done_label", inverse.system())) // `collision` and `sfx` are not ordered with respect to // each other, and may run in any order - .with_system(collision.system()) - .with_system(sfx.system()), + .with_system(collision) + .with_system(sfx), ) .add_system( - exit.system() - .after(PostPhysics) + exit.after(PostPhysics) // Label the run criteria such that the `PostPhysics` set can reference it - .with_run_criteria(is_done.system().label("is_done_label")), + .with_run_criteria(is_done.label("is_done_label")), ) .run(); } diff --git a/examples/ecs/timers.rs b/examples/ecs/timers.rs index 94b66d6d3e..12f3bfb1f1 100644 --- a/examples/ecs/timers.rs +++ b/examples/ecs/timers.rs @@ -4,9 +4,9 @@ fn main() { App::new() .add_plugins(DefaultPlugins) .insert_resource(Countdown::default()) - .add_startup_system(setup_system.system()) - .add_system(countdown_system.system()) - .add_system(timer_system.system()) + .add_startup_system(setup_system) + .add_system(countdown_system) + .add_system(timer_system) .run(); } diff --git a/examples/game/alien_cake_addict.rs b/examples/game/alien_cake_addict.rs index 5300c7e203..e639aa7950 100644 --- a/examples/game/alien_cake_addict.rs +++ b/examples/game/alien_cake_addict.rs @@ -18,29 +18,25 @@ fn main() { .init_resource::() .add_plugins(DefaultPlugins) .add_state(GameState::Playing) - .add_startup_system(setup_cameras.system()) - .add_system_set(SystemSet::on_enter(GameState::Playing).with_system(setup.system())) + .add_startup_system(setup_cameras) + .add_system_set(SystemSet::on_enter(GameState::Playing).with_system(setup)) .add_system_set( SystemSet::on_update(GameState::Playing) - .with_system(move_player.system()) - .with_system(focus_camera.system()) - .with_system(rotate_bonus.system()) - .with_system(scoreboard_system.system()), + .with_system(move_player) + .with_system(focus_camera) + .with_system(rotate_bonus) + .with_system(scoreboard_system), ) - .add_system_set(SystemSet::on_exit(GameState::Playing).with_system(teardown.system())) - .add_system_set( - SystemSet::on_enter(GameState::GameOver).with_system(display_score.system()), - ) - .add_system_set( - SystemSet::on_update(GameState::GameOver).with_system(gameover_keyboard.system()), - ) - .add_system_set(SystemSet::on_exit(GameState::GameOver).with_system(teardown.system())) + .add_system_set(SystemSet::on_exit(GameState::Playing).with_system(teardown)) + .add_system_set(SystemSet::on_enter(GameState::GameOver).with_system(display_score)) + .add_system_set(SystemSet::on_update(GameState::GameOver).with_system(gameover_keyboard)) + .add_system_set(SystemSet::on_exit(GameState::GameOver).with_system(teardown)) .add_system_set( SystemSet::new() .with_run_criteria(FixedTimestep::step(5.0)) - .with_system(spawn_bonus.system()), + .with_system(spawn_bonus), ) - .add_system(bevy::input::system::exit_on_esc_system.system()) + .add_system(bevy::input::system::exit_on_esc_system) .run(); } diff --git a/examples/game/breakout.rs b/examples/game/breakout.rs index 45c1902f9f..26ef9bdcbe 100644 --- a/examples/game/breakout.rs +++ b/examples/game/breakout.rs @@ -12,16 +12,16 @@ fn main() { .add_plugins(DefaultPlugins) .insert_resource(Scoreboard { score: 0 }) .insert_resource(ClearColor(Color::rgb(0.9, 0.9, 0.9))) - .add_startup_system(setup.system()) + .add_startup_system(setup) .add_system_set( SystemSet::new() .with_run_criteria(FixedTimestep::step(TIME_STEP as f64)) - .with_system(paddle_movement_system.system()) - .with_system(ball_collision_system.system()) - .with_system(ball_movement_system.system()), + .with_system(paddle_movement_system) + .with_system(ball_collision_system) + .with_system(ball_movement_system), ) - .add_system(scoreboard_system.system()) - .add_system(bevy::input::system::exit_on_esc_system.system()) + .add_system(scoreboard_system) + .add_system(bevy::input::system::exit_on_esc_system) .run(); } diff --git a/examples/hello_world.rs b/examples/hello_world.rs index 4afa256a2f..3f09f5c4c7 100644 --- a/examples/hello_world.rs +++ b/examples/hello_world.rs @@ -1,7 +1,7 @@ use bevy::prelude::*; fn main() { - App::new().add_system(hello_world_system.system()).run(); + App::new().add_system(hello_world_system).run(); } fn hello_world_system() { diff --git a/examples/input/char_input_events.rs b/examples/input/char_input_events.rs index 956312e679..5e478a35cc 100644 --- a/examples/input/char_input_events.rs +++ b/examples/input/char_input_events.rs @@ -3,7 +3,7 @@ use bevy::{prelude::*, window::ReceivedCharacter}; fn main() { App::new() .add_plugins(DefaultPlugins) - .add_system(print_char_event_system.system()) + .add_system(print_char_event_system) .run(); } diff --git a/examples/input/gamepad_input.rs b/examples/input/gamepad_input.rs index b55810c8e1..24bd872f48 100644 --- a/examples/input/gamepad_input.rs +++ b/examples/input/gamepad_input.rs @@ -8,8 +8,8 @@ fn main() { App::new() .add_plugins(DefaultPlugins) .init_resource::() - .add_system_to_stage(CoreStage::PreUpdate, connection_system.system()) - .add_system(gamepad_system.system()) + .add_system_to_stage(CoreStage::PreUpdate, connection_system) + .add_system(gamepad_system) .run(); } diff --git a/examples/input/gamepad_input_events.rs b/examples/input/gamepad_input_events.rs index 1f02504bbd..efbbbdf3c6 100644 --- a/examples/input/gamepad_input_events.rs +++ b/examples/input/gamepad_input_events.rs @@ -6,7 +6,7 @@ use bevy::{ fn main() { App::new() .add_plugins(DefaultPlugins) - .add_system(gamepad_events.system()) + .add_system(gamepad_events) .run(); } diff --git a/examples/input/keyboard_input.rs b/examples/input/keyboard_input.rs index 27e8c6b8c9..0d6becefd9 100644 --- a/examples/input/keyboard_input.rs +++ b/examples/input/keyboard_input.rs @@ -6,7 +6,7 @@ use bevy::{ fn main() { App::new() .add_plugins(DefaultPlugins) - .add_system(keyboard_input_system.system()) + .add_system(keyboard_input_system) .run(); } diff --git a/examples/input/keyboard_input_events.rs b/examples/input/keyboard_input_events.rs index 07629ed26a..e9de57d5b3 100644 --- a/examples/input/keyboard_input_events.rs +++ b/examples/input/keyboard_input_events.rs @@ -3,7 +3,7 @@ use bevy::{input::keyboard::KeyboardInput, prelude::*}; fn main() { App::new() .add_plugins(DefaultPlugins) - .add_system(print_keyboard_event_system.system()) + .add_system(print_keyboard_event_system) .run(); } diff --git a/examples/input/keyboard_modifiers.rs b/examples/input/keyboard_modifiers.rs index 425851d12d..a22275bb0a 100644 --- a/examples/input/keyboard_modifiers.rs +++ b/examples/input/keyboard_modifiers.rs @@ -6,7 +6,7 @@ use bevy::{ fn main() { App::new() .add_plugins(DefaultPlugins) - .add_system(keyboard_input_system.system()) + .add_system(keyboard_input_system) .run(); } diff --git a/examples/input/mouse_input.rs b/examples/input/mouse_input.rs index e0e4fbb598..6c214b0cf2 100644 --- a/examples/input/mouse_input.rs +++ b/examples/input/mouse_input.rs @@ -3,7 +3,7 @@ use bevy::prelude::*; fn main() { App::new() .add_plugins(DefaultPlugins) - .add_system(mouse_click_system.system()) + .add_system(mouse_click_system) .run(); } diff --git a/examples/input/mouse_input_events.rs b/examples/input/mouse_input_events.rs index b68249c9e6..16c2a7a74a 100644 --- a/examples/input/mouse_input_events.rs +++ b/examples/input/mouse_input_events.rs @@ -7,7 +7,7 @@ use bevy::{ fn main() { App::new() .add_plugins(DefaultPlugins) - .add_system(print_mouse_events_system.system()) + .add_system(print_mouse_events_system) .run(); } diff --git a/examples/input/touch_input.rs b/examples/input/touch_input.rs index 08700964b0..1616959fc1 100644 --- a/examples/input/touch_input.rs +++ b/examples/input/touch_input.rs @@ -3,7 +3,7 @@ use bevy::{input::touch::*, prelude::*}; fn main() { App::new() .add_plugins(DefaultPlugins) - .add_system(touch_system.system()) + .add_system(touch_system) .run(); } diff --git a/examples/input/touch_input_events.rs b/examples/input/touch_input_events.rs index 53f068b9af..49cecfcd1c 100644 --- a/examples/input/touch_input_events.rs +++ b/examples/input/touch_input_events.rs @@ -3,7 +3,7 @@ use bevy::{input::touch::*, prelude::*}; fn main() { App::new() .add_plugins(DefaultPlugins) - .add_system(touch_event_system.system()) + .add_system(touch_event_system) .run(); } diff --git a/examples/ios/src/lib.rs b/examples/ios/src/lib.rs index 3e01ca8451..978390d1a7 100644 --- a/examples/ios/src/lib.rs +++ b/examples/ios/src/lib.rs @@ -12,8 +12,8 @@ fn main() { }) .insert_resource(Msaa { samples: 4 }) .add_plugins(DefaultPlugins) - .add_startup_system(setup_scene.system()) - .add_startup_system(setup_music.system()) + .add_startup_system(setup_scene) + .add_startup_system(setup_music) .run(); } /// set up a simple 3D scene diff --git a/examples/reflection/generic_reflection.rs b/examples/reflection/generic_reflection.rs index 933ae63c2b..9fba61831c 100644 --- a/examples/reflection/generic_reflection.rs +++ b/examples/reflection/generic_reflection.rs @@ -6,7 +6,7 @@ fn main() { App::new() .add_plugins(DefaultPlugins) .register_type::>() - .add_startup_system(setup.system()) + .add_startup_system(setup) .run(); } diff --git a/examples/reflection/reflection.rs b/examples/reflection/reflection.rs index 2d07383be8..24f522614e 100644 --- a/examples/reflection/reflection.rs +++ b/examples/reflection/reflection.rs @@ -15,7 +15,7 @@ fn main() { .add_plugins(DefaultPlugins) .register_type::() .register_type::() - .add_startup_system(setup.system()) + .add_startup_system(setup) .run(); } diff --git a/examples/reflection/reflection_types.rs b/examples/reflection/reflection_types.rs index 88ebc6bede..c19f25e274 100644 --- a/examples/reflection/reflection_types.rs +++ b/examples/reflection/reflection_types.rs @@ -9,7 +9,7 @@ use serde::{Deserialize, Serialize}; fn main() { App::new() .add_plugins(DefaultPlugins) - .add_startup_system(setup.system()) + .add_startup_system(setup) .run(); } diff --git a/examples/reflection/trait_reflection.rs b/examples/reflection/trait_reflection.rs index 78bd3f5229..9dba2f34ff 100644 --- a/examples/reflection/trait_reflection.rs +++ b/examples/reflection/trait_reflection.rs @@ -3,7 +3,7 @@ use bevy::{prelude::*, reflect::TypeRegistry}; fn main() { App::new() .add_plugins(DefaultPlugins) - .add_startup_system(setup.system()) + .add_startup_system(setup) .register_type::() .run(); } diff --git a/examples/scene/scene.rs b/examples/scene/scene.rs index 188dddcb6a..67c0b303c1 100644 --- a/examples/scene/scene.rs +++ b/examples/scene/scene.rs @@ -7,9 +7,9 @@ fn main() { .register_type::() .register_type::() .add_startup_system(save_scene_system.exclusive_system()) - .add_startup_system(load_scene_system.system()) - .add_startup_system(infotext_system.system()) - .add_system(log_system.system()) + .add_startup_system(load_scene_system) + .add_startup_system(infotext_system) + .add_system(log_system) .run(); } diff --git a/examples/shader/animate_shader.rs b/examples/shader/animate_shader.rs index e4b0232a1e..aff72e3e6a 100644 --- a/examples/shader/animate_shader.rs +++ b/examples/shader/animate_shader.rs @@ -15,8 +15,8 @@ use bevy::{ pub fn main() { App::new() .add_plugins(DefaultPlugins) - .add_startup_system(setup.system()) - .add_system(animate_shader.system()) + .add_startup_system(setup) + .add_system(animate_shader) .run(); } diff --git a/examples/shader/array_texture.rs b/examples/shader/array_texture.rs index 34dde74f53..fba6d5800d 100644 --- a/examples/shader/array_texture.rs +++ b/examples/shader/array_texture.rs @@ -16,8 +16,8 @@ fn main() { App::new() .add_plugins(DefaultPlugins) .add_asset::() - .add_startup_system(setup.system()) - .add_system(create_array_texture.system()) + .add_startup_system(setup) + .add_system(create_array_texture) .run(); } diff --git a/examples/shader/hot_shader_reloading.rs b/examples/shader/hot_shader_reloading.rs index 22673d33e3..08fc65189a 100644 --- a/examples/shader/hot_shader_reloading.rs +++ b/examples/shader/hot_shader_reloading.rs @@ -16,7 +16,7 @@ fn main() { App::new() .add_plugins(DefaultPlugins) .add_asset::() - .add_startup_system(setup.system()) + .add_startup_system(setup) .run(); } diff --git a/examples/shader/mesh_custom_attribute.rs b/examples/shader/mesh_custom_attribute.rs index f8a8530add..c9a188aef9 100644 --- a/examples/shader/mesh_custom_attribute.rs +++ b/examples/shader/mesh_custom_attribute.rs @@ -11,7 +11,7 @@ use bevy::{ fn main() { App::new() .add_plugins(DefaultPlugins) - .add_startup_system(setup.system()) + .add_startup_system(setup) .run(); } diff --git a/examples/shader/shader_custom_material.rs b/examples/shader/shader_custom_material.rs index feca59fd2e..4be05c87fe 100644 --- a/examples/shader/shader_custom_material.rs +++ b/examples/shader/shader_custom_material.rs @@ -16,7 +16,7 @@ fn main() { App::new() .add_plugins(DefaultPlugins) .add_asset::() - .add_startup_system(setup.system()) + .add_startup_system(setup) .run(); } diff --git a/examples/shader/shader_defs.rs b/examples/shader/shader_defs.rs index 385b4d33f3..ab9e4f8c46 100644 --- a/examples/shader/shader_defs.rs +++ b/examples/shader/shader_defs.rs @@ -17,10 +17,10 @@ fn main() { App::new() .add_plugins(DefaultPlugins) .add_asset::() - .add_startup_system(setup.system()) + .add_startup_system(setup) .add_system_to_stage( CoreStage::PostUpdate, - asset_shader_defs_system::.system(), + asset_shader_defs_system::, ) .run(); } diff --git a/examples/tools/bevymark.rs b/examples/tools/bevymark.rs index 4296406bdd..26abaec4ff 100644 --- a/examples/tools/bevymark.rs +++ b/examples/tools/bevymark.rs @@ -44,11 +44,11 @@ fn main() { .add_plugin(FrameTimeDiagnosticsPlugin::default()) .insert_resource(BevyCounter { count: 0 }) .init_resource::() - .add_startup_system(setup.system()) - .add_system(mouse_handler.system()) - .add_system(movement_system.system()) - .add_system(collision_system.system()) - .add_system(counter_system.system()) + .add_startup_system(setup) + .add_system(mouse_handler) + .add_system(movement_system) + .add_system(collision_system) + .add_system(counter_system) .run(); } diff --git a/examples/ui/button.rs b/examples/ui/button.rs index 769985de1c..144c7dad22 100644 --- a/examples/ui/button.rs +++ b/examples/ui/button.rs @@ -6,8 +6,8 @@ fn main() { App::new() .add_plugins(DefaultPlugins) .init_resource::() - .add_startup_system(setup.system()) - .add_system(button_system.system()) + .add_startup_system(setup) + .add_system(button_system) .run(); } diff --git a/examples/ui/font_atlas_debug.rs b/examples/ui/font_atlas_debug.rs index 97bf79e2ba..163a7181d6 100644 --- a/examples/ui/font_atlas_debug.rs +++ b/examples/ui/font_atlas_debug.rs @@ -8,9 +8,9 @@ fn main() { .init_resource::() .insert_resource(ClearColor(Color::BLACK)) .add_plugins(DefaultPlugins) - .add_startup_system(setup.system()) - .add_system(text_update_system.system()) - .add_system(atlas_render_system.system()) + .add_startup_system(setup) + .add_system(text_update_system) + .add_system(atlas_render_system) .run(); } diff --git a/examples/ui/text.rs b/examples/ui/text.rs index d51cb6aa37..2b0b96fc0d 100644 --- a/examples/ui/text.rs +++ b/examples/ui/text.rs @@ -10,9 +10,9 @@ fn main() { App::new() .add_plugins(DefaultPlugins) .add_plugin(FrameTimeDiagnosticsPlugin::default()) - .add_startup_system(setup.system()) - .add_system(text_update_system.system()) - .add_system(text_color_system.system()) + .add_startup_system(setup) + .add_system(text_update_system) + .add_system(text_color_system) .run(); } diff --git a/examples/ui/text_debug.rs b/examples/ui/text_debug.rs index 97a0827734..938f49c5e5 100644 --- a/examples/ui/text_debug.rs +++ b/examples/ui/text_debug.rs @@ -12,8 +12,8 @@ fn main() { }) .add_plugins(DefaultPlugins) .add_plugin(FrameTimeDiagnosticsPlugin) - .add_startup_system(infotext_system.system()) - .add_system(change_text_system.system()) + .add_startup_system(infotext_system) + .add_system(change_text_system) .run(); } diff --git a/examples/ui/ui.rs b/examples/ui/ui.rs index 38c3a47bfc..7278ce21ce 100644 --- a/examples/ui/ui.rs +++ b/examples/ui/ui.rs @@ -4,7 +4,7 @@ use bevy::prelude::*; fn main() { App::new() .add_plugins(DefaultPlugins) - .add_startup_system(setup.system()) + .add_startup_system(setup) .run(); } diff --git a/examples/wasm/assets_wasm.rs b/examples/wasm/assets_wasm.rs index ed8e7e6007..e1dc3ba00c 100644 --- a/examples/wasm/assets_wasm.rs +++ b/examples/wasm/assets_wasm.rs @@ -13,8 +13,8 @@ fn main() { .add_plugins(DefaultPlugins) .add_asset::() .init_asset_loader::() - .add_startup_system(load_asset.system()) - .add_system(print_asset.system()) + .add_startup_system(load_asset) + .add_system(print_asset) .run(); } diff --git a/examples/wasm/headless_wasm.rs b/examples/wasm/headless_wasm.rs index 1fc3ca85f9..50af3837df 100644 --- a/examples/wasm/headless_wasm.rs +++ b/examples/wasm/headless_wasm.rs @@ -12,8 +12,8 @@ fn main() { ))) .add_plugin(ScheduleRunnerPlugin::default()) .add_plugin(LogPlugin::default()) - .add_startup_system(hello_world_system.system()) - .add_system(counter.system()) + .add_startup_system(hello_world_system) + .add_system(counter) .run(); } diff --git a/examples/wasm/hello_wasm.rs b/examples/wasm/hello_wasm.rs index 6699e265ed..ae7c3a8eed 100644 --- a/examples/wasm/hello_wasm.rs +++ b/examples/wasm/hello_wasm.rs @@ -3,7 +3,7 @@ use bevy::{log::LogPlugin, prelude::*}; fn main() { App::new() .add_plugin(LogPlugin::default()) - .add_system(hello_wasm_system.system()) + .add_system(hello_wasm_system) .run(); } diff --git a/examples/wasm/winit_wasm.rs b/examples/wasm/winit_wasm.rs index b6c9529d51..f7a4353dfc 100644 --- a/examples/wasm/winit_wasm.rs +++ b/examples/wasm/winit_wasm.rs @@ -15,11 +15,11 @@ fn main() { }) .add_plugins(DefaultPlugins) // One time greet - .add_startup_system(hello_wasm_system.system()) + .add_startup_system(hello_wasm_system) // Track ticks (sanity check, whether game loop is running) - .add_system(counter.system()) + .add_system(counter) // Track input events - .add_system(track_input_events.system()) + .add_system(track_input_events) .run(); } diff --git a/examples/window/multiple_windows.rs b/examples/window/multiple_windows.rs index 4f134fdbc8..57c1e2f824 100644 --- a/examples/window/multiple_windows.rs +++ b/examples/window/multiple_windows.rs @@ -18,10 +18,8 @@ fn main() { .insert_resource(Msaa { samples: 4 }) .add_state(AppState::CreateWindow) .add_plugins(DefaultPlugins) - .add_system_set( - SystemSet::on_update(AppState::CreateWindow).with_system(setup_window.system()), - ) - .add_system_set(SystemSet::on_update(AppState::Setup).with_system(setup_pipeline.system())) + .add_system_set(SystemSet::on_update(AppState::CreateWindow).with_system(setup_window)) + .add_system_set(SystemSet::on_update(AppState::Setup).with_system(setup_pipeline)) .run(); } diff --git a/examples/window/scale_factor_override.rs b/examples/window/scale_factor_override.rs index 18c0ce4ee2..e8ba75869f 100644 --- a/examples/window/scale_factor_override.rs +++ b/examples/window/scale_factor_override.rs @@ -9,9 +9,9 @@ fn main() { ..Default::default() }) .add_plugins(DefaultPlugins) - .add_startup_system(setup.system()) - .add_system(toggle_override.system()) - .add_system(change_scale_factor.system()) + .add_startup_system(setup) + .add_system(toggle_override) + .add_system(change_scale_factor) .run(); } diff --git a/examples/window/window_settings.rs b/examples/window/window_settings.rs index 0792c68f63..8cb3f8beff 100644 --- a/examples/window/window_settings.rs +++ b/examples/window/window_settings.rs @@ -11,8 +11,8 @@ fn main() { ..Default::default() }) .add_plugins(DefaultPlugins) - .add_system(change_title.system()) - .add_system(toggle_cursor.system()) + .add_system(change_title) + .add_system(toggle_cursor) .run(); } diff --git a/src/lib.rs b/src/lib.rs index cf314d3e20..0cb5b4c17b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -16,7 +16,7 @@ //! //! fn main() { //! App::new() -//! .add_system(hello_world_system.system()) +//! .add_system(hello_world_system) //! .run(); //! } //! diff --git a/tests/how_to_test_systems.rs b/tests/how_to_test_systems.rs index b70807aafa..08dff13d73 100644 --- a/tests/how_to_test_systems.rs +++ b/tests/how_to_test_systems.rs @@ -32,8 +32,8 @@ fn did_hurt_enemy() { // Setup stage with our two systems let mut update_stage = SystemStage::parallel(); - update_stage.add_system(hurt_enemies.system().before("death")); - update_stage.add_system(despawn_dead_enemies.system().label("death")); + update_stage.add_system(hurt_enemies.before("death")); + update_stage.add_system(despawn_dead_enemies.label("death")); // Setup test entities let enemy_id = world.spawn().insert(Enemy { hit_points: 5 }).id(); @@ -53,8 +53,8 @@ fn did_despawn_enemy() { // Setup stage with our two systems let mut update_stage = SystemStage::parallel(); - update_stage.add_system(hurt_enemies.system().before("death")); - update_stage.add_system(despawn_dead_enemies.system().label("death")); + update_stage.add_system(hurt_enemies.before("death")); + update_stage.add_system(despawn_dead_enemies.label("death")); // Setup test entities let enemy_id = world.spawn().insert(Enemy { hit_points: 1 }).id(); @@ -73,7 +73,7 @@ fn spawn_enemy_using_input_resource() { // Setup stage with a system let mut update_stage = SystemStage::parallel(); - update_stage.add_system(spawn_enemy.system()); + update_stage.add_system(spawn_enemy); // Setup test resource let mut input = Input::::default();