rat_salsa

Trait AppState

Source
pub trait AppState<Global, Event, Error>
where Event: 'static + Send, Error: 'static + Send,
{ // Provided methods fn init( &mut self, ctx: &mut AppContext<'_, Global, Event, Error>, ) -> Result<(), Error> { ... } fn shutdown( &mut self, ctx: &mut AppContext<'_, Global, Event, Error>, ) -> Result<(), Error> { ... } fn event( &mut self, event: &Event, ctx: &mut AppContext<'_, Global, Event, Error>, ) -> Result<Control<Event>, Error> { ... } fn error( &self, event: Error, ctx: &mut AppContext<'_, Global, Event, Error>, ) -> Result<Control<Event>, Error> { ... } }
Expand description

AppState executes events and has some init and error-handling.

There is no separate shutdown, handle this case with an application specific event.

Provided Methods§

Source

fn init( &mut self, ctx: &mut AppContext<'_, Global, Event, Error>, ) -> Result<(), Error>

Initialize the application. Runs before the first repaint.

Source

fn shutdown( &mut self, ctx: &mut AppContext<'_, Global, Event, Error>, ) -> Result<(), Error>

Shutdown the application. Runs after the event-loop has ended.

Panic

Doesn’t run if a panic occurred.

Errors Any errors will be returned to main().

Source

fn event( &mut self, event: &Event, ctx: &mut AppContext<'_, Global, Event, Error>, ) -> Result<Control<Event>, Error>

Handle an event.

Source

fn error( &self, event: Error, ctx: &mut AppContext<'_, Global, Event, Error>, ) -> Result<Control<Event>, Error>

Do error handling.

Implementors§