Trait intelli_shell::Widget

source ·
pub trait Widget {
    // Required method
    fn min_height(&self) -> usize;

    // Provided methods
    fn peek(&mut self) -> Result<Option<WidgetOutput>> { ... }
    fn render<B: Backend>(
        &mut self,
        _frame: &mut Frame<'_, B>,
        _area: Rect,
        _inline: bool,
        _theme: Theme
    ) { ... }
    fn process_event(&mut self, _event: Event) -> Result<Option<WidgetOutput>> { ... }
    fn show<B, F>(
        self,
        terminal: &mut Terminal<B>,
        inline: bool,
        theme: Theme,
        area: F
    ) -> Result<WidgetOutput>
       where B: Backend,
             F: FnMut(&Frame<'_, B>) -> Rect,
             Self: Sized { ... }
}
Expand description

Trait to display Widgets on the shell

Required Methods§

source

fn min_height(&self) -> usize

Minimum height needed to render the widget

Provided Methods§

source

fn peek(&mut self) -> Result<Option<WidgetOutput>>

Peeks into the result to check wether the UI should be shown (None) or we can give a straight result (Some)

source

fn render<B: Backend>( &mut self, _frame: &mut Frame<'_, B>, _area: Rect, _inline: bool, _theme: Theme )

Render self in the given area from the frame

source

fn process_event(&mut self, _event: Event) -> Result<Option<WidgetOutput>>

Process user input event and return Some to end user interaction or None to keep waiting for user input

source

fn show<B, F>( self, terminal: &mut Terminal<B>, inline: bool, theme: Theme, area: F ) -> Result<WidgetOutput>where B: Backend, F: FnMut(&Frame<'_, B>) -> Rect, Self: Sized,

Run this widget render and process_event until we’ve got a result

Implementors§