mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 13:20:05 -04:00
Support returning errors when creating the app (#4565)
The closure passed to `eframe::run_native` now returns a `Result`, allowing you to return an error during app creation, which will be returned to the caller of `run_native`. This means you need to wrap your `Box::new(MyApp::new(…))` in an `Ok(…)`. * Closes https://github.com/emilk/egui/issues/4474
This commit is contained in:
@@ -182,7 +182,7 @@ impl WgpuWinitApp {
|
||||
storage: Option<Box<dyn Storage>>,
|
||||
window: Window,
|
||||
builder: ViewportBuilder,
|
||||
) -> Result<&mut WgpuWinitRunning, egui_wgpu::WgpuError> {
|
||||
) -> crate::Result<&mut WgpuWinitRunning> {
|
||||
crate::profile_function!();
|
||||
|
||||
#[allow(unsafe_code, unused_mut, unused_unsafe)]
|
||||
@@ -272,7 +272,7 @@ impl WgpuWinitApp {
|
||||
};
|
||||
let app = {
|
||||
crate::profile_scope!("user_app_creator");
|
||||
app_creator(&cc)
|
||||
app_creator(&cc).map_err(crate::Error::AppCreation)?
|
||||
};
|
||||
|
||||
let mut viewport_from_window = HashMap::default();
|
||||
|
||||
Reference in New Issue
Block a user