egui_glium::run parameter app now has signature Box<dyn App>

This commit is contained in:
Emil Ernerfeldt 2020-12-14 11:24:37 +01:00
parent 0f7a5287b2
commit 09aa905f7c
4 changed files with 9 additions and 7 deletions

View file

@ -12,5 +12,5 @@ fn main() {
// let storage = egui::app::DummyStorage::default(); // let storage = egui::app::DummyStorage::default();
let app: egui::DemoApp = egui::app::get_value(&storage, egui::app::APP_KEY).unwrap_or_default(); let app: egui::DemoApp = egui::app::get_value(&storage, egui::app::APP_KEY).unwrap_or_default();
egui_glium::run(title, Box::new(storage), app); egui_glium::run(title, Box::new(storage), Box::new(app));
} }

View file

@ -8,6 +8,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Changed ### Changed
* `egui_glium::run`: the parameter `app` now has signature `Box<dyn App>` (you need to add `Box::new(app)` to your code).
## 0.5.0 - 2020-12-13
### Changed
* FileStorage::from_path now takes `Into<Path>` instead of `String` * FileStorage::from_path now takes `Into<Path>` instead of `String`
## 0.4.0 - 2020-11-28 ## 0.4.0 - 2020-11-28

View file

@ -64,11 +64,7 @@ fn create_display(
} }
/// Run an egui app /// Run an egui app
pub fn run( pub fn run(title: &str, mut storage: Box<dyn egui::app::Storage>, mut app: Box<dyn App>) -> ! {
title: &str,
mut storage: Box<dyn egui::app::Storage>,
mut app: impl App + 'static,
) -> ! {
let window_settings: Option<WindowSettings> = let window_settings: Option<WindowSettings> =
egui::app::get_value(storage.as_ref(), WINDOW_KEY); egui::app::get_value(storage.as_ref(), WINDOW_KEY);
let event_loop = glutin::event_loop::EventLoop::with_user_event(); let event_loop = glutin::event_loop::EventLoop::with_user_event();

View file

@ -18,5 +18,5 @@ fn main() {
// Restore `example_app` from file, or create new `ExampleApp`: // Restore `example_app` from file, or create new `ExampleApp`:
let app: ExampleApp = egui::app::get_value(&storage, egui::app::APP_KEY).unwrap_or_default(); let app: ExampleApp = egui::app::get_value(&storage, egui::app::APP_KEY).unwrap_or_default();
egui_glium::run(title, Box::new(storage), app); egui_glium::run(title, Box::new(storage), Box::new(app));
} }