pub trait Process {
    // Required methods
    fn min_height(&self) -> usize;
    fn render<B: Backend>(&mut self, frame: &mut Frame<'_, B>, area: Rect);
    fn process_raw_event(
        &mut self,
        event: Event
    ) -> Result<Option<ProcessOutput>>;

    // Provided methods
    fn peek(&mut self) -> Result<Option<ProcessOutput>> { ... }
    fn show<B, F>(
        self,
        terminal: &mut Terminal<B>,
        area: F
    ) -> Result<ProcessOutput>
       where B: Backend,
             F: FnMut(&Frame<'_, B>) -> Rect,
             Self: Sized { ... }
}
Expand description

Trait to display a process on the shell

Required Methods§

source

fn min_height(&self) -> usize

Minimum height needed to render the process

source

fn render<B: Backend>(&mut self, frame: &mut Frame<'_, B>, area: Rect)

Render self in the given area from the frame

source

fn process_raw_event(&mut self, event: Event) -> Result<Option<ProcessOutput>>

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

Provided Methods§

source

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

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

source

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

Run this process render and process_event until we’ve got an output

Implementors§