pub trait TaskPresenter: Send + Sync {
// Required methods
fn prefix(&self, task: &TaskId) -> Vec<u8> ⓘ;
fn summary_completed(
&self,
task: &TaskId,
record: &CompletedRecord,
duration: Duration,
) -> Option<Vec<u8>>;
fn summary_skipped(
&self,
task: &TaskId,
record: &SkipRecord,
) -> Option<Vec<u8>>;
fn summary_cancelled(
&self,
task: &TaskId,
record: &CancelledRecord,
duration: Option<Duration>,
) -> Option<Vec<u8>>;
}Expand description
Strategy object the crate::output observers consult for
presentation-policy bytes.
Implementations decide how to render the bearing-task prefix and the optional terminal summary line. The trait is intentionally narrow: it does not see the observer’s sinks, any timing source other than the duration the observer hands it, or any byte the task wrote. A presenter is a pure function of the lifecycle event plus its own configuration (palette, glyph set, etc.).
Send + Sync lets the observers store the presenter behind an
Arc<dyn TaskPresenter> and share it across concurrent
on_* calls without further coordination.
Required Methods§
Sourcefn prefix(&self, task: &TaskId) -> Vec<u8> ⓘ
fn prefix(&self, task: &TaskId) -> Vec<u8> ⓘ
Bytes that prefix each captured line of task in live
mode. Buffered observers ignore this method; the prefix
has no role when the task’s bytes flush as a single block.
The returned slice MUST NOT contain a trailing newline:
the observer concatenates it with the captured line plus
\n.
Sourcefn summary_completed(
&self,
task: &TaskId,
record: &CompletedRecord,
duration: Duration,
) -> Option<Vec<u8>>
fn summary_completed( &self, task: &TaskId, record: &CompletedRecord, duration: Duration, ) -> Option<Vec<u8>>
Bytes of the summary line for a task whose lookup-then-
spawn pipeline completed (succeeded or failed per
EXEC-009). Returning None suppresses the line; the
observer emits nothing for the terminal callback.
duration is the wall-clock elapsed between
crate::run_task::RunObserver::on_task_started and the
terminal callback the observer is currently handling.
The returned bytes MUST be a complete line including the trailing newline; the observer writes them verbatim.
Sourcefn summary_skipped(&self, task: &TaskId, record: &SkipRecord) -> Option<Vec<u8>>
fn summary_skipped(&self, task: &TaskId, record: &SkipRecord) -> Option<Vec<u8>>
Bytes of the summary line for a task the scheduler
cascade-skipped per EXEC-010 / EXEC-011. No duration
is associated with a skip: the task never entered the
pipeline.
Same None / newline contract as Self::summary_completed.
Sourcefn summary_cancelled(
&self,
task: &TaskId,
record: &CancelledRecord,
duration: Option<Duration>,
) -> Option<Vec<u8>>
fn summary_cancelled( &self, task: &TaskId, record: &CancelledRecord, duration: Option<Duration>, ) -> Option<Vec<u8>>
Bytes of the summary line for a task whose terminal state
was reached through the cancellation flow per
EXEC-012..EXEC-015.
duration is Some for
CancelledRecord::SignaledInFlight (the task ran for
duration before the signal). For the other two variants
(UpstreamCancelled, RunCancelled) the task never
entered the spawn step, so duration is None.
Same None / newline contract as Self::summary_completed.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".