File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -373,9 +373,9 @@ impl App {
373373 stage_label : impl StageLabel ,
374374 system : impl IntoSystemDescriptor < Params > ,
375375 ) -> & mut Self {
376- use std :: any :: TypeId ;
376+ let stage_label = stage_label . as_label ( ) ;
377377 assert ! (
378- stage_label. type_id ( ) != TypeId :: of :: <StartupStage >( ) ,
378+ ! stage_label. is :: <StartupStage >( ) ,
379379 "add systems to a startup stage using App::add_startup_system_to_stage"
380380 ) ;
381381 self . schedule . add_system_to_stage ( stage_label, system) ;
@@ -408,9 +408,9 @@ impl App {
408408 stage_label : impl StageLabel ,
409409 system_set : SystemSet ,
410410 ) -> & mut Self {
411- use std :: any :: TypeId ;
411+ let stage_label = stage_label . as_label ( ) ;
412412 assert ! (
413- stage_label. type_id ( ) != TypeId :: of :: <StartupStage >( ) ,
413+ ! stage_label. is :: <StartupStage >( ) ,
414414 "add system sets to a startup stage using App::add_startup_system_set_to_stage"
415415 ) ;
416416 self . schedule
Original file line number Diff line number Diff line change @@ -131,5 +131,15 @@ macro_rules! define_label {
131131 self . data( ) . hash( state) ;
132132 }
133133 }
134+
135+ impl $id_name {
136+ /// Returns true if this label was constructed from an instance of type `L`.
137+ pub fn is<L : $label_name>( self ) -> bool {
138+ // FIXME: This is potentially incorrect, due to the
139+ // compiler unifying identical functions. We'll likely
140+ // have to store some kind of hash of the TypeId.
141+ ( self . f as usize ) == ( <L as $label_name>:: fmt as usize )
142+ }
143+ }
134144 } ;
135145}
You can’t perform that action at this time.
0 commit comments