@@ -4,7 +4,7 @@ use crate::{
44 schedule:: {
55 condition:: { BoxedCondition , Condition } ,
66 graph_utils:: { Ambiguity , Dependency , DependencyKind , GraphInfo } ,
7- set:: { BoxedSystemSet , IntoSystemSet , SystemSet } ,
7+ set:: { IntoSystemSet , SystemSet , SystemSetUntyped } ,
88 } ,
99 system:: { BoxedSystem , IntoSystem , System } ,
1010} ;
@@ -20,7 +20,7 @@ fn new_condition<M>(condition: impl Condition<M>) -> BoxedCondition {
2020 Box :: new ( condition_system)
2121}
2222
23- fn ambiguous_with ( graph_info : & mut GraphInfo , set : BoxedSystemSet ) {
23+ fn ambiguous_with ( graph_info : & mut GraphInfo , set : SystemSetUntyped ) {
2424 match & mut graph_info. ambiguous_with {
2525 detection @ Ambiguity :: Check => {
2626 * detection = Ambiguity :: IgnoreWithSet ( vec ! [ set] ) ;
@@ -83,20 +83,20 @@ impl SystemConfigs {
8383 } )
8484 }
8585
86- pub ( crate ) fn in_set_inner ( & mut self , set : BoxedSystemSet ) {
86+ pub ( crate ) fn in_set_inner ( & mut self , set : SystemSetUntyped ) {
8787 match self {
8888 SystemConfigs :: SystemConfig ( config) => {
8989 config. graph_info . sets . push ( set) ;
9090 }
9191 SystemConfigs :: Configs { configs, .. } => {
9292 for config in configs {
93- config. in_set_inner ( set. dyn_clone ( ) ) ;
93+ config. in_set_inner ( set) ;
9494 }
9595 }
9696 }
9797 }
9898
99- fn before_inner ( & mut self , set : BoxedSystemSet ) {
99+ fn before_inner ( & mut self , set : SystemSetUntyped ) {
100100 match self {
101101 SystemConfigs :: SystemConfig ( config) => {
102102 config
@@ -106,13 +106,13 @@ impl SystemConfigs {
106106 }
107107 SystemConfigs :: Configs { configs, .. } => {
108108 for config in configs {
109- config. before_inner ( set. dyn_clone ( ) ) ;
109+ config. before_inner ( set) ;
110110 }
111111 }
112112 }
113113 }
114114
115- fn after_inner ( & mut self , set : BoxedSystemSet ) {
115+ fn after_inner ( & mut self , set : SystemSetUntyped ) {
116116 match self {
117117 SystemConfigs :: SystemConfig ( config) => {
118118 config
@@ -122,7 +122,7 @@ impl SystemConfigs {
122122 }
123123 SystemConfigs :: Configs { configs, .. } => {
124124 for config in configs {
125- config. after_inner ( set. dyn_clone ( ) ) ;
125+ config. after_inner ( set) ;
126126 }
127127 }
128128 }
@@ -141,14 +141,14 @@ impl SystemConfigs {
141141 }
142142 }
143143
144- fn ambiguous_with_inner ( & mut self , set : BoxedSystemSet ) {
144+ fn ambiguous_with_inner ( & mut self , set : SystemSetUntyped ) {
145145 match self {
146146 SystemConfigs :: SystemConfig ( config) => {
147147 ambiguous_with ( & mut config. graph_info , set) ;
148148 }
149149 SystemConfigs :: Configs { configs, .. } => {
150150 for config in configs {
151- config. ambiguous_with_inner ( set. dyn_clone ( ) ) ;
151+ config. ambiguous_with_inner ( set) ;
152152 }
153153 }
154154 }
@@ -302,25 +302,26 @@ impl IntoSystemConfigs<()> for SystemConfigs {
302302
303303 #[ track_caller]
304304 fn in_set ( mut self , set : impl SystemSet ) -> Self {
305+ let set = SystemSetUntyped :: of ( & set) ;
305306 assert ! (
306307 set. system_type( ) . is_none( ) ,
307308 "adding arbitrary systems to a system type set is not allowed"
308309 ) ;
309310
310- self . in_set_inner ( set. dyn_clone ( ) ) ;
311+ self . in_set_inner ( set) ;
311312
312313 self
313314 }
314315
315316 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) ;
318319 self
319320 }
320321
321322 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) ;
324325 self
325326 }
326327
@@ -330,8 +331,8 @@ impl IntoSystemConfigs<()> for SystemConfigs {
330331 }
331332
332333 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) ;
335336 self
336337 }
337338
@@ -382,13 +383,13 @@ all_tuples!(impl_system_collection, 1, 20, P, S);
382383
383384/// A [`SystemSet`] with scheduling metadata.
384385pub struct SystemSetConfig {
385- pub ( super ) set : BoxedSystemSet ,
386+ pub ( super ) set : SystemSetUntyped ,
386387 pub ( super ) graph_info : GraphInfo ,
387388 pub ( super ) conditions : Vec < BoxedCondition > ,
388389}
389390
390391impl SystemSetConfig {
391- fn new ( set : BoxedSystemSet ) -> Self {
392+ fn new ( set : SystemSetUntyped ) -> Self {
392393 // system type sets are automatically populated
393394 // to avoid unintentionally broad changes, they cannot be configured
394395 assert ! (
@@ -445,11 +446,11 @@ pub trait IntoSystemSetConfig: Sized {
445446
446447impl < S : SystemSet > IntoSystemSetConfig for S {
447448 fn into_config ( self ) -> SystemSetConfig {
448- SystemSetConfig :: new ( Box :: new ( self ) )
449+ SystemSetConfig :: new ( SystemSetUntyped :: of ( & self ) )
449450 }
450451}
451452
452- impl IntoSystemSetConfig for BoxedSystemSet {
453+ impl IntoSystemSetConfig for SystemSetUntyped {
453454 fn into_config ( self ) -> SystemSetConfig {
454455 SystemSetConfig :: new ( self )
455456 }
@@ -462,27 +463,28 @@ impl IntoSystemSetConfig for SystemSetConfig {
462463
463464 #[ track_caller]
464465 fn in_set ( mut self , set : impl SystemSet ) -> Self {
466+ let set = SystemSetUntyped :: of ( & set) ;
465467 assert ! (
466468 set. system_type( ) . is_none( ) ,
467469 "adding arbitrary systems to a system type set is not allowed"
468470 ) ;
469- self . graph_info . sets . push ( Box :: new ( set) ) ;
471+ self . graph_info . sets . push ( set) ;
470472 self
471473 }
472474
473475 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 ) ) ;
478480 self
479481 }
480482
481483 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 ) ) ;
486488 self
487489 }
488490
@@ -492,7 +494,8 @@ impl IntoSystemSetConfig for SystemSetConfig {
492494 }
493495
494496 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) ;
496499 self
497500 }
498501
@@ -561,45 +564,46 @@ impl IntoSystemSetConfigs for SystemSetConfigs {
561564
562565 #[ track_caller]
563566 fn in_set ( mut self , set : impl SystemSet ) -> Self {
567+ let set = SystemSetUntyped :: of ( & set) ;
564568 assert ! (
565569 set. system_type( ) . is_none( ) ,
566570 "adding arbitrary systems to a system type set is not allowed"
567571 ) ;
568572 for config in & mut self . sets {
569- config. graph_info . sets . push ( set. dyn_clone ( ) ) ;
573+ config. graph_info . sets . push ( set) ;
570574 }
571575
572576 self
573577 }
574578
575579 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 ( ) ) ;
577581 for config in & mut self . sets {
578582 config
579583 . graph_info
580584 . dependencies
581- . push ( Dependency :: new ( DependencyKind :: Before , set. dyn_clone ( ) ) ) ;
585+ . push ( Dependency :: new ( DependencyKind :: Before , set) ) ;
582586 }
583587
584588 self
585589 }
586590
587591 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 ( ) ) ;
589593 for config in & mut self . sets {
590594 config
591595 . graph_info
592596 . dependencies
593- . push ( Dependency :: new ( DependencyKind :: After , set. dyn_clone ( ) ) ) ;
597+ . push ( Dependency :: new ( DependencyKind :: After , set) ) ;
594598 }
595599
596600 self
597601 }
598602
599603 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 ( ) ) ;
601605 for config in & mut self . sets {
602- ambiguous_with ( & mut config. graph_info , set. dyn_clone ( ) ) ;
606+ ambiguous_with ( & mut config. graph_info , set) ;
603607 }
604608
605609 self
0 commit comments