Skip to main content

Module run

Module run 

Source
Expand description

Event loop driver for the rtcom TUI.

run owns the ratatui Terminal, the crossterm key-event stream, and the bus subscription. It multiplexes them via tokio::select!, re-rendering the app after every iteration and unwinding cleanly on cancel / user-initiated quit / terminal error.

The three RAII guards (RawModeGuard, AltScreenGuard, and the implicit Terminal drop) guarantee the terminal is restored to its original state on every exit path — including panic — so foreground shells keep working even if rtcom crashes mid-frame.

T17 wired the live-apply / line-toggle / send-break actions through the bus into the session. T18 extends this with the save-flavored (ApplyAndSave, WriteProfile, ReadProfile, …) actions — these mutate Profile in memory, persist it to TOML via rtcom_config::write, and publish Event::ProfileSaved / Event::ProfileLoadFailed so T19’s toast layer can surface the outcome to the user.

Functions§

run
Drive the TUI main loop until cancelled or the user requests quit.
summarise
Build the short "<baud> <DATA><PARITY><STOP> <flow>" status-bar string used on the top row (e.g. "115200 8N1 none").