@@ -4,7 +4,7 @@ use crate::{
4
4
schedule:: {
5
5
condition:: { BoxedCondition , Condition } ,
6
6
graph_utils:: { Ambiguity , Dependency , DependencyKind , GraphInfo } ,
7
- set:: { BoxedSystemSet , IntoSystemSet , SystemSet } ,
7
+ set:: { IntoSystemSet , SystemSet , SystemSetUntyped } ,
8
8
} ,
9
9
system:: { BoxedSystem , IntoSystem , System } ,
10
10
} ;
@@ -20,7 +20,7 @@ fn new_condition<M>(condition: impl Condition<M>) -> BoxedCondition {
20
20
Box :: new ( condition_system)
21
21
}
22
22
23
- fn ambiguous_with ( graph_info : & mut GraphInfo , set : BoxedSystemSet ) {
23
+ fn ambiguous_with ( graph_info : & mut GraphInfo , set : SystemSetUntyped ) {
24
24
match & mut graph_info. ambiguous_with {
25
25
detection @ Ambiguity :: Check => {
26
26
* detection = Ambiguity :: IgnoreWithSet ( vec ! [ set] ) ;
@@ -83,20 +83,20 @@ impl SystemConfigs {
83
83
} )
84
84
}
85
85
86
- pub ( crate ) fn in_set_inner ( & mut self , set : BoxedSystemSet ) {
86
+ pub ( crate ) fn in_set_inner ( & mut self , set : SystemSetUntyped ) {
87
87
match self {
88
88
SystemConfigs :: SystemConfig ( config) => {
89
89
config. graph_info . sets . push ( set) ;
90
90
}
91
91
SystemConfigs :: Configs { configs, .. } => {
92
92
for config in configs {
93
- config. in_set_inner ( set. dyn_clone ( ) ) ;
93
+ config. in_set_inner ( set) ;
94
94
}
95
95
}
96
96
}
97
97
}
98
98
99
- fn before_inner ( & mut self , set : BoxedSystemSet ) {
99
+ fn before_inner ( & mut self , set : SystemSetUntyped ) {
100
100
match self {
101
101
SystemConfigs :: SystemConfig ( config) => {
102
102
config
@@ -106,13 +106,13 @@ impl SystemConfigs {
106
106
}
107
107
SystemConfigs :: Configs { configs, .. } => {
108
108
for config in configs {
109
- config. before_inner ( set. dyn_clone ( ) ) ;
109
+ config. before_inner ( set) ;
110
110
}
111
111
}
112
112
}
113
113
}
114
114
115
- fn after_inner ( & mut self , set : BoxedSystemSet ) {
115
+ fn after_inner ( & mut self , set : SystemSetUntyped ) {
116
116
match self {
117
117
SystemConfigs :: SystemConfig ( config) => {
118
118
config
@@ -122,7 +122,7 @@ impl SystemConfigs {
122
122
}
123
123
SystemConfigs :: Configs { configs, .. } => {
124
124
for config in configs {
125
- config. after_inner ( set. dyn_clone ( ) ) ;
125
+ config. after_inner ( set) ;
126
126
}
127
127
}
128
128
}
@@ -141,14 +141,14 @@ impl SystemConfigs {
141
141
}
142
142
}
143
143
144
- fn ambiguous_with_inner ( & mut self , set : BoxedSystemSet ) {
144
+ fn ambiguous_with_inner ( & mut self , set : SystemSetUntyped ) {
145
145
match self {
146
146
SystemConfigs :: SystemConfig ( config) => {
147
147
ambiguous_with ( & mut config. graph_info , set) ;
148
148
}
149
149
SystemConfigs :: Configs { configs, .. } => {
150
150
for config in configs {
151
- config. ambiguous_with_inner ( set. dyn_clone ( ) ) ;
151
+ config. ambiguous_with_inner ( set) ;
152
152
}
153
153
}
154
154
}
@@ -302,25 +302,26 @@ impl IntoSystemConfigs<()> for SystemConfigs {
302
302
303
303
#[ track_caller]
304
304
fn in_set ( mut self , set : impl SystemSet ) -> Self {
305
+ let set = SystemSetUntyped :: of ( & set) ;
305
306
assert ! (
306
307
set. system_type( ) . is_none( ) ,
307
308
"adding arbitrary systems to a system type set is not allowed"
308
309
) ;
309
310
310
- self . in_set_inner ( set. dyn_clone ( ) ) ;
311
+ self . in_set_inner ( set) ;
311
312
312
313
self
313
314
}
314
315
315
316
fn before < M > ( mut self , set : impl IntoSystemSet < M > ) -> Self {
316
- let set = set. into_system_set ( ) ;
317
- self . before_inner ( set. dyn_clone ( ) ) ;
317
+ let set = SystemSetUntyped :: of ( & set. into_system_set ( ) ) ;
318
+ self . before_inner ( set) ;
318
319
self
319
320
}
320
321
321
322
fn after < M > ( mut self , set : impl IntoSystemSet < M > ) -> Self {
322
- let set = set. into_system_set ( ) ;
323
- self . after_inner ( set. dyn_clone ( ) ) ;
323
+ let set = SystemSetUntyped :: of ( & set. into_system_set ( ) ) ;
324
+ self . after_inner ( set) ;
324
325
self
325
326
}
326
327
@@ -330,8 +331,8 @@ impl IntoSystemConfigs<()> for SystemConfigs {
330
331
}
331
332
332
333
fn ambiguous_with < M > ( mut self , set : impl IntoSystemSet < M > ) -> Self {
333
- let set = set. into_system_set ( ) ;
334
- self . ambiguous_with_inner ( set. dyn_clone ( ) ) ;
334
+ let set = SystemSetUntyped :: of ( & set. into_system_set ( ) ) ;
335
+ self . ambiguous_with_inner ( set) ;
335
336
self
336
337
}
337
338
@@ -382,13 +383,13 @@ all_tuples!(impl_system_collection, 1, 20, P, S);
382
383
383
384
/// A [`SystemSet`] with scheduling metadata.
384
385
pub struct SystemSetConfig {
385
- pub ( super ) set : BoxedSystemSet ,
386
+ pub ( super ) set : SystemSetUntyped ,
386
387
pub ( super ) graph_info : GraphInfo ,
387
388
pub ( super ) conditions : Vec < BoxedCondition > ,
388
389
}
389
390
390
391
impl SystemSetConfig {
391
- fn new ( set : BoxedSystemSet ) -> Self {
392
+ fn new ( set : SystemSetUntyped ) -> Self {
392
393
// system type sets are automatically populated
393
394
// to avoid unintentionally broad changes, they cannot be configured
394
395
assert ! (
@@ -445,11 +446,11 @@ pub trait IntoSystemSetConfig: Sized {
445
446
446
447
impl < S : SystemSet > IntoSystemSetConfig for S {
447
448
fn into_config ( self ) -> SystemSetConfig {
448
- SystemSetConfig :: new ( Box :: new ( self ) )
449
+ SystemSetConfig :: new ( SystemSetUntyped :: of ( & self ) )
449
450
}
450
451
}
451
452
452
- impl IntoSystemSetConfig for BoxedSystemSet {
453
+ impl IntoSystemSetConfig for SystemSetUntyped {
453
454
fn into_config ( self ) -> SystemSetConfig {
454
455
SystemSetConfig :: new ( self )
455
456
}
@@ -462,27 +463,28 @@ impl IntoSystemSetConfig for SystemSetConfig {
462
463
463
464
#[ track_caller]
464
465
fn in_set ( mut self , set : impl SystemSet ) -> Self {
466
+ let set = SystemSetUntyped :: of ( & set) ;
465
467
assert ! (
466
468
set. system_type( ) . is_none( ) ,
467
469
"adding arbitrary systems to a system type set is not allowed"
468
470
) ;
469
- self . graph_info . sets . push ( Box :: new ( set) ) ;
471
+ self . graph_info . sets . push ( set) ;
470
472
self
471
473
}
472
474
473
475
fn before < M > ( mut self , set : impl IntoSystemSet < M > ) -> Self {
474
- self . graph_info . dependencies . push ( Dependency :: new (
475
- DependencyKind :: Before ,
476
- Box :: new ( set . into_system_set ( ) ) ,
477
- ) ) ;
476
+ let set = SystemSetUntyped :: of ( & set . into_system_set ( ) ) ;
477
+ self . graph_info
478
+ . dependencies
479
+ . push ( Dependency :: new ( DependencyKind :: Before , set ) ) ;
478
480
self
479
481
}
480
482
481
483
fn after < M > ( mut self , set : impl IntoSystemSet < M > ) -> Self {
482
- self . graph_info . dependencies . push ( Dependency :: new (
483
- DependencyKind :: After ,
484
- Box :: new ( set . into_system_set ( ) ) ,
485
- ) ) ;
484
+ let set = SystemSetUntyped :: of ( & set . into_system_set ( ) ) ;
485
+ self . graph_info
486
+ . dependencies
487
+ . push ( Dependency :: new ( DependencyKind :: After , set ) ) ;
486
488
self
487
489
}
488
490
@@ -492,7 +494,8 @@ impl IntoSystemSetConfig for SystemSetConfig {
492
494
}
493
495
494
496
fn ambiguous_with < M > ( mut self , set : impl IntoSystemSet < M > ) -> Self {
495
- ambiguous_with ( & mut self . graph_info , Box :: new ( set. into_system_set ( ) ) ) ;
497
+ let set = SystemSetUntyped :: of ( & set. into_system_set ( ) ) ;
498
+ ambiguous_with ( & mut self . graph_info , set) ;
496
499
self
497
500
}
498
501
@@ -561,45 +564,46 @@ impl IntoSystemSetConfigs for SystemSetConfigs {
561
564
562
565
#[ track_caller]
563
566
fn in_set ( mut self , set : impl SystemSet ) -> Self {
567
+ let set = SystemSetUntyped :: of ( & set) ;
564
568
assert ! (
565
569
set. system_type( ) . is_none( ) ,
566
570
"adding arbitrary systems to a system type set is not allowed"
567
571
) ;
568
572
for config in & mut self . sets {
569
- config. graph_info . sets . push ( set. dyn_clone ( ) ) ;
573
+ config. graph_info . sets . push ( set) ;
570
574
}
571
575
572
576
self
573
577
}
574
578
575
579
fn before < M > ( mut self , set : impl IntoSystemSet < M > ) -> Self {
576
- let set = set. into_system_set ( ) ;
580
+ let set = SystemSetUntyped :: of ( & set. into_system_set ( ) ) ;
577
581
for config in & mut self . sets {
578
582
config
579
583
. graph_info
580
584
. dependencies
581
- . push ( Dependency :: new ( DependencyKind :: Before , set. dyn_clone ( ) ) ) ;
585
+ . push ( Dependency :: new ( DependencyKind :: Before , set) ) ;
582
586
}
583
587
584
588
self
585
589
}
586
590
587
591
fn after < M > ( mut self , set : impl IntoSystemSet < M > ) -> Self {
588
- let set = set. into_system_set ( ) ;
592
+ let set = SystemSetUntyped :: of ( & set. into_system_set ( ) ) ;
589
593
for config in & mut self . sets {
590
594
config
591
595
. graph_info
592
596
. dependencies
593
- . push ( Dependency :: new ( DependencyKind :: After , set. dyn_clone ( ) ) ) ;
597
+ . push ( Dependency :: new ( DependencyKind :: After , set) ) ;
594
598
}
595
599
596
600
self
597
601
}
598
602
599
603
fn ambiguous_with < M > ( mut self , set : impl IntoSystemSet < M > ) -> Self {
600
- let set = set. into_system_set ( ) ;
604
+ let set = SystemSetUntyped :: of ( & set. into_system_set ( ) ) ;
601
605
for config in & mut self . sets {
602
- ambiguous_with ( & mut config. graph_info , set. dyn_clone ( ) ) ;
606
+ ambiguous_with ( & mut config. graph_info , set) ;
603
607
}
604
608
605
609
self
0 commit comments