Trait tui_view::Opts

source ·
pub trait Opts {
    // Required method
    fn get_pages(&self) -> Vec<Page>;

    // Provided methods
    fn keybinds(&self, key: KeyEvent, app: App) -> App { ... }
    fn get_keywords(&self) -> Vec<&'static str> { ... }
}
Expand description

create_view function expects a Struct that implements this trait. All data and behaviour is transfered into the frontend through this.

Required Methods§

source

fn get_pages(&self) -> Vec<Page>

This is supposed to return the actual data to be loaded into the app as Page structs.

Provided Methods§

source

fn keybinds(&self, key: KeyEvent, app: App) -> App

This is called on (pretty much) every key event and how the consumer customizes the app’s behaviour. They can match on the key event and define behaviours accordindly.

source

fn get_keywords(&self) -> Vec<&'static str>

You can define words here that will take priority in search.

Implementors§