Trait fiadtui::App

source ·
pub trait App {
    type AppMessage;

    // Required methods
    fn draw(&mut self, frame: &mut Frame<'_>);
    fn handle_event(&self, event: Event) -> Option<Message<Self::AppMessage>>;
    fn handle_message(
        &mut self,
        message: Self::AppMessage
    ) -> Option<impl Future<Output = Message<Self::AppMessage>> + Send + 'static>;
}
Expand description

Application behavior.

Required Associated Types§

Required Methods§

source

fn draw(&mut self, frame: &mut Frame<'_>)

After every message, this function is called to draw the UI.

As Ratatui is an immediate mode library, this very simply renders the whole UI on each call.

The state is expected to be stored in the App implementation.

source

fn handle_event(&self, event: Event) -> Option<Message<Self::AppMessage>>

Handle events.

This function is called for every event. It maps the event to an (optional) message which may be handled by the application.

source

fn handle_message( &mut self, message: Self::AppMessage ) -> Option<impl Future<Output = Message<Self::AppMessage>> + Send + 'static>

Handle messages.

This function is called for every message. It may modify the state of the application, and (optionally) returns a future which will return a message in the future.

Object Safety§

This trait is not object safe.

Implementors§