@@ -5,11 +5,11 @@ use crate::{
5
5
prelude:: IntoSystem ,
6
6
schedule:: {
7
7
graph_utils:: { self , DependencyGraphError } ,
8
- BoxedRunCriteria , DuplicateLabelStrategy , FunctionSystemContainer , GraphNode ,
9
- InsertionPoint , ParallelExecutor , ParallelSystemExecutor , RunCriteriaContainer ,
10
- RunCriteriaDescriptor , RunCriteriaDescriptorOrLabel , RunCriteriaInner , RunCriteriaLabelId ,
11
- ShouldRun , SingleThreadedExecutor , SystemContainer , SystemDescriptor , SystemLabelId ,
12
- SystemSet , SystemType ,
8
+ BoxedRunCriteria , DuplicateLabelStrategy , GraphNode , InsertionPoint , ParallelExecutor ,
9
+ ParallelSystemExecutor , RunCriteriaContainer , RunCriteriaDescriptor ,
10
+ RunCriteriaDescriptorOrLabel , RunCriteriaInner , RunCriteriaLabelId , ShouldRun ,
11
+ SingleThreadedExecutor , SystemContainer , SystemDescriptor , SystemLabelId , SystemSet ,
12
+ SystemType ,
13
13
} ,
14
14
world:: { World , WorldId } ,
15
15
} ;
@@ -62,22 +62,22 @@ pub struct SystemStage {
62
62
/// Topologically sorted run criteria of systems.
63
63
run_criteria : Vec < RunCriteriaContainer > ,
64
64
/// Topologically sorted exclusive systems that want to be run at the start of the stage.
65
- pub ( super ) exclusive_at_start : Vec < FunctionSystemContainer > ,
65
+ pub ( super ) exclusive_at_start : Vec < SystemContainer > ,
66
66
/// Topologically sorted exclusive systems that want to be run after parallel systems but
67
67
/// before the application of their command buffers.
68
- pub ( super ) exclusive_before_commands : Vec < FunctionSystemContainer > ,
68
+ pub ( super ) exclusive_before_commands : Vec < SystemContainer > ,
69
69
/// Topologically sorted exclusive systems that want to be run at the end of the stage.
70
- pub ( super ) exclusive_at_end : Vec < FunctionSystemContainer > ,
70
+ pub ( super ) exclusive_at_end : Vec < SystemContainer > ,
71
71
/// Topologically sorted parallel systems.
72
- pub ( super ) parallel : Vec < FunctionSystemContainer > ,
72
+ pub ( super ) parallel : Vec < SystemContainer > ,
73
73
/// Determines if the stage was modified and needs to rebuild its graphs and orders.
74
74
pub ( super ) systems_modified : bool ,
75
75
/// Determines if the stage's executor was changed.
76
76
executor_modified : bool ,
77
77
/// Newly inserted run criteria that will be initialized at the next opportunity.
78
78
uninitialized_run_criteria : Vec < ( usize , DuplicateLabelStrategy ) > ,
79
79
/// Newly inserted systems that will be initialized at the next opportunity.
80
- uninitialized_systems : Vec < ( FunctionSystemContainer , SystemType ) > ,
80
+ uninitialized_systems : Vec < ( SystemContainer , SystemType ) > ,
81
81
/// Saves the value of the World change_tick during the last tick check
82
82
last_tick_check : u32 ,
83
83
/// If true, buffers will be automatically applied at the end of the stage. If false, buffers must be manually applied.
@@ -155,7 +155,7 @@ impl SystemStage {
155
155
self . systems_modified = true ;
156
156
let system_type = descriptor. system_type ;
157
157
let criteria = descriptor. run_criteria . take ( ) ;
158
- let mut container = FunctionSystemContainer :: from_descriptor ( descriptor) ;
158
+ let mut container = SystemContainer :: from_descriptor ( descriptor) ;
159
159
match criteria {
160
160
Some ( RunCriteriaDescriptorOrLabel :: Label ( label) ) => {
161
161
container. run_criteria_label = Some ( label) ;
@@ -189,29 +189,29 @@ impl SystemStage {
189
189
/// Topologically sorted parallel systems.
190
190
///
191
191
/// Note that systems won't be fully-formed until the stage has been run at least once.
192
- pub fn parallel_systems ( & self ) -> & [ impl SystemContainer ] {
192
+ pub fn parallel_systems ( & self ) -> & [ SystemContainer ] {
193
193
& self . parallel
194
194
}
195
195
196
196
/// Topologically sorted exclusive systems that want to be run at the start of the stage.
197
197
///
198
198
/// Note that systems won't be fully-formed until the stage has been run at least once.
199
- pub fn exclusive_at_start_systems ( & self ) -> & [ impl SystemContainer ] {
199
+ pub fn exclusive_at_start_systems ( & self ) -> & [ SystemContainer ] {
200
200
& self . exclusive_at_start
201
201
}
202
202
203
203
/// Topologically sorted exclusive systems that want to be run at the end of the stage.
204
204
///
205
205
/// Note that systems won't be fully-formed until the stage has been run at least once.
206
- pub fn exclusive_at_end_systems ( & self ) -> & [ impl SystemContainer ] {
206
+ pub fn exclusive_at_end_systems ( & self ) -> & [ SystemContainer ] {
207
207
& self . exclusive_at_end
208
208
}
209
209
210
210
/// Topologically sorted exclusive systems that want to be run after parallel systems but
211
211
/// before the application of their command buffers.
212
212
///
213
213
/// Note that systems won't be fully-formed until the stage has been run at least once.
214
- pub fn exclusive_before_commands_systems ( & self ) -> & [ impl SystemContainer ] {
214
+ pub fn exclusive_before_commands_systems ( & self ) -> & [ SystemContainer ] {
215
215
& self . exclusive_before_commands
216
216
}
217
217
@@ -515,8 +515,8 @@ impl SystemStage {
515
515
}
516
516
}
517
517
518
- fn update_run_criteria_indices < T : SystemContainer > (
519
- systems : & mut [ T ] ,
518
+ fn update_run_criteria_indices (
519
+ systems : & mut [ SystemContainer ] ,
520
520
order_inverted : & [ ( usize , & usize ) ] ,
521
521
) {
522
522
for system in systems {
@@ -542,7 +542,7 @@ impl SystemStage {
542
542
/// Sorts given system containers topologically, populates their resolved dependencies
543
543
/// and run criteria.
544
544
fn process_systems (
545
- systems : & mut Vec < impl SystemContainer > ,
545
+ systems : & mut Vec < SystemContainer > ,
546
546
run_criteria_labels : & HashMap < RunCriteriaLabelId , usize > ,
547
547
) -> Result < ( ) , DependencyGraphError < HashSet < SystemLabelId > > > {
548
548
let mut graph = graph_utils:: build_dependency_graph ( systems) ;
@@ -638,7 +638,7 @@ impl Stage for SystemStage {
638
638
run_system_loop = false ;
639
639
640
640
fn should_run (
641
- container : & impl SystemContainer ,
641
+ container : & SystemContainer ,
642
642
run_criteria : & [ RunCriteriaContainer ] ,
643
643
default : ShouldRun ,
644
644
) -> bool {
@@ -800,7 +800,7 @@ mod tests {
800
800
use crate :: {
801
801
schedule:: {
802
802
IntoSystemDescriptor , RunCriteria , RunCriteriaDescriptorCoercion , ShouldRun ,
803
- SingleThreadedExecutor , Stage , SystemLabel , SystemLabelId , SystemSet , SystemStage ,
803
+ SingleThreadedExecutor , Stage , SystemLabel , SystemSet , SystemStage ,
804
804
} ,
805
805
system:: { In , Local , Query , ResMut } ,
806
806
world:: World ,
@@ -978,13 +978,7 @@ mod tests {
978
978
. with_system ( make_exclusive ( 1 ) . before ( L234 ) . after ( L0 ) )
979
979
. with_system ( make_exclusive ( 0 ) . label ( L0 ) )
980
980
. with_system ( make_exclusive ( 4 ) . label ( L234 ) . label ( L4 ) )
981
- . with_system (
982
- make_exclusive ( 3 )
983
-
984
- . label ( L234 )
985
- . after ( L2 )
986
- . before ( L4 ) ,
987
- ) ;
981
+ . with_system ( make_exclusive ( 3 ) . label ( L234 ) . after ( L2 ) . before ( L4 ) ) ;
988
982
stage. run ( & mut world) ;
989
983
stage. set_executor ( Box :: new ( SingleThreadedExecutor :: default ( ) ) ) ;
990
984
stage. run ( & mut world) ;
@@ -999,31 +993,11 @@ mod tests {
999
993
let mut world = World :: new ( ) ;
1000
994
world. init_resource :: < EntityCount > ( ) ;
1001
995
let mut stage = SystemStage :: parallel ( )
1002
- . with_system (
1003
- make_exclusive ( 2 )
1004
-
1005
- . label ( L2 )
1006
- . after ( L1 )
1007
- . before ( L3 )
1008
- . before ( L3 ) ,
1009
- )
1010
- . with_system (
1011
- make_exclusive ( 1 )
1012
-
1013
- . label ( L1 )
1014
- . after ( L0 )
1015
- . after ( L0 )
1016
- . before ( L2 ) ,
1017
- )
996
+ . with_system ( make_exclusive ( 2 ) . label ( L2 ) . after ( L1 ) . before ( L3 ) . before ( L3 ) )
997
+ . with_system ( make_exclusive ( 1 ) . label ( L1 ) . after ( L0 ) . after ( L0 ) . before ( L2 ) )
1018
998
. with_system ( make_exclusive ( 0 ) . label ( L0 ) . before ( L1 ) )
1019
999
. with_system ( make_exclusive ( 4 ) . label ( L4 ) . after ( L3 ) )
1020
- . with_system (
1021
- make_exclusive ( 3 )
1022
-
1023
- . label ( L3 )
1024
- . after ( L2 )
1025
- . before ( L4 ) ,
1026
- ) ;
1000
+ . with_system ( make_exclusive ( 3 ) . label ( L3 ) . after ( L2 ) . before ( L4 ) ) ;
1027
1001
stage. run ( & mut world) ;
1028
1002
stage. set_executor ( Box :: new ( SingleThreadedExecutor :: default ( ) ) ) ;
1029
1003
stage. run ( & mut world) ;
@@ -1083,8 +1057,7 @@ mod tests {
1083
1057
fn exclusive_cycle_1 ( ) {
1084
1058
let mut world = World :: new ( ) ;
1085
1059
world. init_resource :: < EntityCount > ( ) ;
1086
- let mut stage = SystemStage :: parallel ( )
1087
- . with_system ( make_exclusive ( 0 ) . label ( L0 ) . after ( L0 ) ) ;
1060
+ let mut stage = SystemStage :: parallel ( ) . with_system ( make_exclusive ( 0 ) . label ( L0 ) . after ( L0 ) ) ;
1088
1061
stage. run ( & mut world) ;
1089
1062
}
1090
1063
0 commit comments