Skip to main content

LineItem

Enum LineItem 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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.

Fields

§id: Cow<'static, str>
§segment: Box<dyn Segment>
§

Separator(Separator)

Trait Implementations§

Source§

impl Debug for LineItem

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.