Skip to main content

AppLifecycle

Trait AppLifecycle 

pub trait AppLifecycle {
    // Provided methods
    fn on_start(&mut self, ctx: &mut dyn AppContext) { ... }
    fn on_exit(&mut self) { ... }
}
Expand description

Optional lifecycle hooks — implement on the same type as App to hook startup / shutdown without inflating the main trait.

Provided Methods§

fn on_start(&mut self, ctx: &mut dyn AppContext)

Called once after the backend is up but before the first update. Apps install their theme / fonts here.

fn on_exit(&mut self)

Called once when the window is closing. Persist state here.

Implementors§

§

impl<T> AppLifecycle for T
where T: ?Sized,