pub struct Summary(pub Vec<Segment>);Expand description
A structured, render-ready one-line summary: an ordered list of typed
Segments.
Rule packs build it; renderers format
each segment by its type. This replaces free-text summaries so that
number and path formatting is a render-time decision the renderer makes
from typed values, rather than a fragile reparse of prose. A producer
that owns a concept (a rename detector) owns the wording — it emits the
connective Text and the Paths — while the renderer owns the
typography. See ADR 2026-06-03-structured-summary-segments.
The ergonomic shortcut for the common case is impl Into<Summary>:
with_summary("plain text") still works and produces a single
Segment::Text.
Tuple Fields§
§0: Vec<Segment>Implementations§
Source§impl Summary
impl Summary
pub fn new() -> Self
Sourcepub fn text(self, value: impl Into<String>) -> Self
pub fn text(self, value: impl Into<String>) -> Self
Append verbatim text, coalescing into a trailing text segment if the
summary already ends in one. Keeps the serialized form canonical so
that helpers like Summary::count which emit a count followed by
text don’t leave redundant adjacent text segments on the wire.
Sourcepub fn uint(self, value: u64) -> Self
pub fn uint(self, value: u64) -> Self
Append a non-negative count (renderer applies digit grouping).
Sourcepub fn count(self, n: u64, noun: &str) -> Self
pub fn count(self, n: u64, noun: &str) -> Self
Append a counted noun: "{n} {noun}", with the count as a
Segment::Uint (grouped by the renderer) and the noun pluralized
with a trailing s unless n == 1. For irregular plurals, build the
segments by hand. Example: .count(5, "row") -> 5 rows.
Sourcepub fn float(self, value: f64) -> Self
pub fn float(self, value: f64) -> Self
Append a real-valued quantity (renderer applies decimal policy).
Sourcepub fn path(self, value: impl Into<String>, snapshot: Side) -> Self
pub fn path(self, value: impl Into<String>, snapshot: Side) -> Self
Append a path/locator that resolves in snapshot.
Sourcepub fn extend(&mut self, other: Summary)
pub fn extend(&mut self, other: Summary)
Append all segments of another summary (e.g. when joining child summaries into a trailer).
pub fn is_empty(&self) -> bool
pub fn segments(&self) -> &[Segment]
Sourcepub fn plain_text(&self) -> String
pub fn plain_text(&self) -> String
Plain-text rendering with no formatting policy applied: text and path values verbatim, numbers in bare decimal form. For consumers without a renderer (Python bindings, machine sinks, provenance) and for internal bookkeeping such as path-statement detection.
Sourcepub fn capitalize_first(self) -> Self
pub fn capitalize_first(self) -> Self
Uppercase the first character of the leading text segment, if the summary begins with text. No-op when it begins with a number or path. Mirrors sentence-casing of prose without scanning a built string.