Trait kas_core::AppData

source ·
pub trait AppData: 'static {
    // Required method
    fn handle_messages(&mut self, messages: &mut ErasedStack) -> Action;
}
Expand description

Application state

Kas allows state to be stored in Adapt and user-defined widgets within windows, but sometimes you want top-level application state too (especially for data shared between windows). Such state implements this trait and is passed to the shell/runner’s constructor.

When no top-level data is required, use () which implements this trait.

Required Methods§

source

fn handle_messages(&mut self, messages: &mut ErasedStack) -> Action

Handle messages

This is the last message handler: it is called when, after traversing the widget tree (see kas::event module doc), a message is left on the stack. Unhandled messages will result in warnings in the log.

The method returns an Action, usually either Action::empty (nothing to do) or Action::UPDATE (to update widgets). This action affects all windows.

Implementations on Foreign Types§

source§

impl AppData for ()

source§

fn handle_messages(&mut self, _: &mut ErasedStack) -> Action

Implementors§