#[non_exhaustive]pub enum LineItem {
Segment {
id: Cow<'static, str>,
segment: Box<dyn Segment>,
},
Separator(Separator),
}Expand description
One slot in a line layout: a configured segment or an inline
separator between segments. The builder (build_segments /
build_lines) interleaves separators between adjacent segments
from [layout_options].separator; the renderer walks this list
directly. See docs/specs/segment-system.md §Data model.
A plugin’s per-render override (RenderedSegment::with_separator)
beats the inline Separator only when an inline-separator slot
exists immediately to the segment’s right. An override on the
rightmost segment, or a segment whose right-neighbor separator
has already been pruned, has no boundary to apply to and is
silently discarded.
Per-variant #[non_exhaustive] is omitted from LineItem::Segment
because consumers pattern-match { id, segment } directly and the
consumer set is narrow (builder + tests + benches). Contrast
LayoutDecision’s per-variant #[non_exhaustive] (ADR-0026 §C):
those events are observability surfaces with an unknown consumer set,
so field-additive forward-compat justifies the , .. pattern cost.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Segment
A segment paired with the user-facing config id that names it
(per ADR-0026). Sourced from LineEntry::segment_id() (the TOML key).
id is a label, not an identity: the layout engine threads it
through LayoutDecision events but does not verify it against the
inner segment’s type. External constructors must keep the two in sync.
Cow::Borrowed vs Cow::Owned is a per-emit allocation trade-off,
not a correctness invariant. Built-in ids land as Cow::Borrowed;
plugin and user-config ids land as Cow::Owned. External
constructors that don’t preserve this partition are correct but pay
one extra allocation per built-in emit.