1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-29 21:00:03 -04:00

Make eframe::App::as_any_mut optional to implement (#2061)

This commit is contained in:
Emil Ernerfeldt
2022-09-20 13:58:55 +02:00
committed by GitHub
parent 311eb66cae
commit 2b0bf82b51
8 changed files with 22 additions and 58 deletions

View File

@@ -266,8 +266,14 @@ impl AppRunner {
}
/// Get mutable access to the concrete [`App`] we enclose.
///
/// This will panic if your app does not implement [`App::as_any_mut`].
pub fn app_mut<ConreteApp: 'static + crate::App>(&mut self) -> &mut ConreteApp {
self.app.as_any_mut().downcast_mut::<ConreteApp>().unwrap()
self.app
.as_any_mut()
.expect("Your app must implement `as_any_mut`, but it doesn't")
.downcast_mut::<ConreteApp>()
.unwrap()
}
pub fn auto_save(&mut self) {