Skip to main content

run

Function run 

Source
pub fn run<B: Backend>(
    terminal: &mut Terminal<B>,
    app: &mut ListApp,
    rx: Receiver<(usize, String)>,
) -> Result<()>
Expand description

Drive the Inline Viewport render loop, consuming (row_index, status) updates from rx until all rows are filled or the sender disconnects.

The caller is responsible for spawning the producer (typically a rayon par_iter inside a std::thread::scope that iterates worktrees in parallel and sends results) and for drawing the initial skeleton frame before calling run (e.g. terminal.draw(|f| app.render(f))). run draws the skeleton itself on its first iteration for backward-compat with test callers that do not pre-draw; the duplicate draw is harmless.

On return, app.rows contains final statuses. The viewport exits via drop(terminal) which leaves the final frame in the scrollback.

Returns std::io::Result<()>. In display.rs, the #[from] impl on CwError::Io converts this to crate::error::Result via From — no manual mapping is needed at the call site.