Fix compilation with persistence feature

This commit is contained in:
Emil Ernerfeldt 2021-07-29 23:04:59 +02:00
parent 42ec177881
commit 9766a9ae08

View file

@ -29,8 +29,15 @@ impl epi::App for TemplateApp {
/// Called by the framework to load old app state (if any).
#[cfg(feature = "persistence")]
fn load(&mut self, storage: &dyn epi::Storage) {
*self = epi::get_value(storage, epi::APP_KEY).unwrap_or_default()
fn setup(
&mut self,
_ctx: &egui::CtxRef,
_frame: &mut epi::Frame<'_>,
storage: Option<&dyn epi::Storage>,
) {
if let Some(storage) = storage {
*self = epi::get_value(storage, epi::APP_KEY).unwrap_or_default()
}
}
/// Called by the frame work to save state before shutdown.