Skip to main content

Module presenter

Module presenter 

Source
Expand description

Presenter port for crate::output observers.

The execution engine (haz-exec) emits a stream of lifecycle events through crate::run_task::RunObserver. The bytes that reach the user’s terminal are produced by an observer implementation in crate::output. Two of those bytes are presentation-policy choices the engine has no opinion on:

  • the per-task line prefix that tags each captured line with the bearing task identity in live mode;
  • the optional per-task summary line emitted on a task’s terminal callback (“done”, “cached”, “failed”, “skipped”, “cancelled”).

The TaskPresenter trait is the seam: an observer holds an Arc<dyn TaskPresenter> and asks it for prefix bytes and summary-line bytes at the right moments in the lifecycle. The presenter sees only TaskIds and the run records the observer already has in hand; it has no view of the underlying sink, the cancellation token, or the cache.

The library ships PlainPresenter as the default: it emits the historical [project:task] prefix and returns None for every summary method, so a cargo test --all-features run sees identical bytes to the pre-trait behaviour. A terminal-aware presenter (color, glyphs, durations) lives in the consuming binary (haz-cli’s output module) and never pulls a colour crate into haz-exec.

Structs§

PlainPresenter
Default TaskPresenter used by the bare crate::output::LiveOutputObserver::new and crate::output::BufferedOutputObserver::new constructors.

Traits§

TaskPresenter
Strategy object the crate::output observers consult for presentation-policy bytes.