pub struct ViewModel {
pub run_a: RunHeader,
pub run_b: RunHeader,
pub idx_width: usize,
pub rows: Vec<Row>,
pub verdict: Verdict,
pub attribution: Option<AttributionView>,
pub deltas: Option<DeltasView>,
pub warnings: Vec<Warning>,
}Expand description
The full semantic view of one diff: everything a painter needs, nothing it must compute.
Fields§
§run_a: RunHeader§run_b: RunHeader§idx_width: usizeDigits for zero-padded step indices (step 06), derived from the runs’ largest step
index — shared number-formatting voice, not a column width (those are data-derived,
these are medium-derived; only the former belong in the seam).
rows: Vec<Row>§verdict: Verdict§attribution: Option<AttributionView>§deltas: Option<DeltasView>Latency / token deltas between the two runs (issue #40), already formatted in the
designed wording. None when DiffResult::deltas is None (nothing to show), not
when a delta happens to be zero — a real zero still renders +0ms.
warnings: Vec<Warning>Pass-through of the result’s warnings so a painter never reaches back into
DiffResult: the CLI keeps warnings on stderr, the web UI surfaces them inline.
Implementations§
Source§impl ViewModel
impl ViewModel
Sourcepub fn compute(result: &DiffResult, reference: &Run, observed: &Run) -> Self
pub fn compute(result: &DiffResult, reference: &Run, observed: &Run) -> Self
Build the semantic view. Pure and total: any DiffResult over its two runs yields a
view, and nothing here inspects the output medium.
Sourcepub fn full_text(&self, address: &SlotAddress) -> Option<&str>
pub fn full_text(&self, address: &SlotAddress) -> Option<&str>
Resolve a SlotAddress back to full text (issue #30: expand-on-demand). Only
meaningful called on a pre-envelope view — ViewModel::compute’s own output, never a
Document’s already-truncated one — so the caller must hold onto that view itself;
nothing here re-derives it. None means the address does not resolve against this view
(a stale address from a different diff, a malformed request), not that the slot is empty.
Sourcepub fn headline(&self) -> String
pub fn headline(&self) -> String
The one-line verdict headline every surface opens with: serve’s terminal handoff
and the web header print the SAME string (issue #25 amendment), so it lives here
with the rest of the designed wording, not in a painter.
Forked: ⑂ forked at step 02 · conf 0.86 — index padded like the gutter, confidence
in the fork row’s designed wording (so marginal call composes for free).
Converged: exactly Verdict::converged_text.