allow exiting via flag
Some checks are pending
/ build (push) Waiting to run

This commit is contained in:
facile pop culture reference 2026-08-06 10:18:35 +03:00
parent 39d3dacf1f
commit cf67185ffd
2 changed files with 12 additions and 10 deletions

View file

@ -145,16 +145,14 @@ impl Tui {
panic(info);
}));
}
pub fn run_main <T> (state: Arc<RwLock<T>>) -> Usually<()> where
pub fn run_main <T> (exit: Exit, state: Arc<RwLock<T>>) -> Usually<()> where
T: View<Tui> + Apply<TuiEvent, Usually<()>> + Send + Sync + 'static
{
Exit::run(|exit|{
let scan = Duration::from_millis(100);
let frame = Duration::from_millis(10);
let (_input, output) = Tui::io(exit.as_ref(), &state, scan, frame, std::io::stdout())?;
let _ = output.join();
Tui::teardown(&mut stdout())
})
let scan = Duration::from_millis(100);
let frame = Duration::from_millis(10);
let (_input, output) = Tui::io(exit.as_ref(), &state, scan, frame, std::io::stdout())?;
let _ = output.join();
Tui::teardown(&mut stdout())
}
/// Spawn the TUI input and output threadsl.
pub fn io <