pub fn run_blocking<B, A>(term: Terminal<B>, app: A) -> Result<(), B::Error>Expand description
Drive an App with a blocking, event-driven loop until it returns Flow::Exit.
Generic over the backend, so it powers every non-inverted backend
(Crossterm in retroglyph-crossterm, Headless)
with no per-backend loop code.
Inverted backends (software/winit) provide their own driver.
The terminal is owned and dropped when the loop exits, so backend teardown (for example crossterm’s terminal restore) runs on the way out.
See App::update for the present/idle contract this and every other driver follows.
Equivalent to run_blocking_with(term, app, RunOptions::default()): on Flow::Idle, blocks
on input rather than calling update again immediately, so a turn-based app that’s idle most
of the time costs approximately nothing. Use run_blocking_with with RunOptions::animated
for a continuously-rendering app instead.
§Errors
Returns the backend’s error if the automatic present() call fails. The loop stops and the
terminal is dropped (running backend teardown) before the error is returned.