Expand description
Session orchestrator: bridges a SerialDevice with the
EventBus.
At v0.1 a Session runs a single task that multiplexes the serial
device, the cancellation token, and the bus subscription via
tokio::select!:
- bytes arriving from the device →
Event::RxBytes; Event::TxBytespublished on the bus → bytes written to the device;Event::Commandpublished on the bus → handler dispatch (Issue #7);- cancellation token tripped or fatal I/O error → publish
Event::DeviceDisconnected(when applicable) and exit cleanly.
The single-task model gives the dispatch handlers exclusive &mut
access to the device, which is required for the synchronous control
operations (set_baud_rate, set_dtr, send_break, …). The
tradeoff is that a long write momentarily delays reads — acceptable
for an interactive serial terminal where writes are short and rare.
Later issues plug in mappers (Issue #8), logging, scripting, and so on as additional bus subscribers.
Structs§
- Session
- Owns a serial device and a bus, and runs the I/O + command loop.