Skip to main content

Component

Trait Component 

Source
pub trait Component {
    // Required method
    fn render(
        &mut self,
        f: &mut Frame<'_>,
        rect: Rect,
        theme: &Theme,
        focused: bool,
    );

    // Provided methods
    fn handle_input(&mut self, event: &InputEvent, tx: &AppTx) -> EventState { ... }
    fn hint_shortcuts(&self) -> Vec<(String, String)> { ... }
}

Required Methods§

Source

fn render( &mut self, f: &mut Frame<'_>, rect: Rect, theme: &Theme, focused: bool, )

Provided Methods§

Source

fn handle_input(&mut self, event: &InputEvent, tx: &AppTx) -> EventState

Handle an event. Send AppEvents through tx for app-level effects. Returns whether this component consumed the event.

Source

fn hint_shortcuts(&self) -> Vec<(String, String)>

Context-sensitive shortcut hints shown in the hints bar when this component is focused. Each entry is (key_display, label).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§