Skip to content

Commit

Permalink
Try #2381:
Browse files Browse the repository at this point in the history
  • Loading branch information
bors[bot] committed Feb 2, 2022
2 parents f991c73 + 913547c commit 5271612
Show file tree
Hide file tree
Showing 9 changed files with 550 additions and 9 deletions.
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,10 @@ path = "examples/ecs/state.rs"
name = "system_chaining"
path = "examples/ecs/system_chaining.rs"

[[example]]
name = "system_graph"
path = "examples/ecs/system_graph.rs"

[[example]]
name = "system_param"
path = "examples/ecs/system_param.rs"
Expand Down
6 changes: 3 additions & 3 deletions crates/bevy_app/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ impl App {
/// .with_system(system_c),
/// );
/// ```
pub fn add_system_set(&mut self, system_set: SystemSet) -> &mut Self {
pub fn add_system_set(&mut self, system_set: impl Into<SystemSet>) -> &mut Self {
self.add_system_set_to_stage(CoreStage::Update, system_set)
}

Expand Down Expand Up @@ -398,7 +398,7 @@ impl App {
pub fn add_system_set_to_stage(
&mut self,
stage_label: impl StageLabel,
system_set: SystemSet,
system_set: impl Into<SystemSet>,
) -> &mut Self {
self.schedule
.add_system_set_to_stage(stage_label, system_set);
Expand Down Expand Up @@ -508,7 +508,7 @@ impl App {
pub fn add_startup_system_set_to_stage(
&mut self,
stage_label: impl StageLabel,
system_set: SystemSet,
system_set: impl Into<SystemSet>,
) -> &mut Self {
self.schedule
.stage(CoreStage::Startup, |schedule: &mut Schedule| {
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_ecs/macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ impl Parse for AllTuples {
#[proc_macro]
pub fn all_tuples(input: TokenStream) -> TokenStream {
let input = parse_macro_input!(input as AllTuples);
let len = (input.start..=input.end).count();
let len = input.end + 1;
let mut ident_tuples = Vec::with_capacity(len);
for i in input.start..=input.end {
for i in 0..=input.end {
let idents = input
.idents
.iter()
Expand Down
3 changes: 2 additions & 1 deletion crates/bevy_ecs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ pub mod prelude {
schedule::{
AmbiguitySetLabel, ExclusiveSystemDescriptorCoercion, ParallelSystemDescriptorCoercion,
RunCriteria, RunCriteriaDescriptorCoercion, RunCriteriaLabel, RunCriteriaPiping,
Schedule, Stage, StageLabel, State, SystemLabel, SystemSet, SystemStage,
Schedule, Stage, StageLabel, State, SystemGraph, SystemGroup, SystemJoin, SystemLabel,
SystemSet, SystemStage,
},
system::{
Commands, ConfigurableSystem, In, IntoChainSystem, IntoExclusiveSystem, IntoSystem,
Expand Down
4 changes: 3 additions & 1 deletion crates/bevy_ecs/src/schedule/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ mod stage;
mod state;
mod system_container;
mod system_descriptor;
mod system_graph;
mod system_set;

pub use executor::*;
Expand All @@ -23,6 +24,7 @@ pub use stage::*;
pub use state::*;
pub use system_container::*;
pub use system_descriptor::*;
pub use system_graph::*;
pub use system_set::*;

use std::fmt::Debug;
Expand Down Expand Up @@ -247,7 +249,7 @@ impl Schedule {
pub fn add_system_set_to_stage(
&mut self,
stage_label: impl StageLabel,
system_set: SystemSet,
system_set: impl Into<SystemSet>,
) -> &mut Self {
self.stage(stage_label, |stage: &mut SystemStage| {
stage.add_system_set(system_set)
Expand Down
5 changes: 3 additions & 2 deletions crates/bevy_ecs/src/schedule/stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,13 @@ impl SystemStage {
&self.exclusive_before_commands
}

pub fn with_system_set(mut self, system_set: SystemSet) -> Self {
pub fn with_system_set(mut self, system_set: impl Into<SystemSet>) -> Self {
self.add_system_set(system_set);
self
}

pub fn add_system_set(&mut self, system_set: SystemSet) -> &mut Self {
pub fn add_system_set(&mut self, system_set: impl Into<SystemSet>) -> &mut Self {
let system_set = system_set.into();
self.systems_modified = true;
let (run_criteria, mut systems) = system_set.bake();
let set_run_criteria_index = run_criteria.and_then(|criteria| {
Expand Down
Loading

0 comments on commit 5271612

Please sign in to comment.