@@ -854,21 +854,38 @@ impl App {
854
854
}
855
855
856
856
/// Retrieves a "sub app" stored inside this [App]. This will panic if the sub app does not exist.
857
- pub fn sub_app ( & mut self , label : impl AppLabel ) -> & mut App {
858
- match self . get_sub_app ( label) {
857
+ pub fn sub_app_mut ( & mut self , label : impl AppLabel ) -> & mut App {
858
+ match self . get_sub_app_mut ( label) {
859
859
Ok ( app) => app,
860
860
Err ( label) => panic ! ( "Sub-App with label '{:?}' does not exist" , label) ,
861
861
}
862
862
}
863
863
864
864
/// Retrieves a "sub app" inside this [App] with the given label, if it exists. Otherwise returns
865
865
/// an [Err] containing the given label.
866
- pub fn get_sub_app ( & mut self , label : impl AppLabel ) -> Result < & mut App , impl AppLabel > {
866
+ pub fn get_sub_app_mut ( & mut self , label : impl AppLabel ) -> Result < & mut App , impl AppLabel > {
867
867
self . sub_apps
868
868
. get_mut ( ( & label) as & dyn AppLabel )
869
869
. map ( |sub_app| & mut sub_app. app )
870
870
. ok_or ( label)
871
871
}
872
+
873
+ /// Retrieves a "sub app" stored inside this [App]. This will panic if the sub app does not exist.
874
+ pub fn sub_app ( & self , label : impl AppLabel ) -> & App {
875
+ match self . get_sub_app ( label) {
876
+ Ok ( app) => app,
877
+ Err ( label) => panic ! ( "Sub-App with label '{:?}' does not exist" , label) ,
878
+ }
879
+ }
880
+
881
+ /// Retrieves a "sub app" inside this [App] with the given label, if it exists. Otherwise returns
882
+ /// an [Err] containing the given label.
883
+ pub fn get_sub_app ( & self , label : impl AppLabel ) -> Result < & App , impl AppLabel > {
884
+ self . sub_apps
885
+ . get ( ( & label) as & dyn AppLabel )
886
+ . map ( |sub_app| & sub_app. app )
887
+ . ok_or ( label)
888
+ }
872
889
}
873
890
874
891
fn run_once ( mut app : App ) {
0 commit comments