Expand description
Async worker pool: WorkerMsg enum, spawn/dispatch helpers, mpsc plumbing.
The terminal panel’s session threads report on the same channel
(TerminalOutput, TerminalExited), though they are OS threads rather than
pool tasks — see crate::terminal::session.
Workers do anything that could be slow (git status, filesystem watching,
syntax highlighting, image decoding) and report results back to the UI
thread over a single mpsc channel drained once per UI tick.
Architecture contract (§4 of trail_architecture.md):
- Every task sends its result as a
WorkerMsgover the sharedSender. - Every
WorkerMsg::Preview/WorkerMsg::ImageMetacarries thegenerationit was spawned for;merge()compares it againststate.preview.generationand drops the message if they don’t match. - Workers never touch
ratatui/crosstermstate directly.
Re-exports§
pub use git::GitCache;
Modules§
- fswatch
- Filesystem watcher.
- git
- Git status worker.
- highlight
- Syntax highlighting worker.
- image_
decode - Image decoding worker.
Enums§
- Worker
Msg - All messages that worker tasks can send back to the UI thread.