Skip to main content

build_lines

Function build_lines 

Source
pub fn build_lines(
    config: Option<&Config>,
    plugins: Option<(PluginRegistry, Arc<Engine>)>,
    warn: impl FnMut(&str),
) -> Vec<Vec<LineItem>>
Expand description

Build a list of segment lists, one per rendered line. Single-line configs return a vec of length 1; multi-line configs return one inner vec per [line.N] sub-table sorted by the parsed integer key. Edge cases per docs/specs/config.md §Edge cases:

  • layout = "multi-line" without usable [line.N] sub-tables warns and falls back to single-line using [line].segments.
  • layout = "single-line" (or unset) with [line.N] tables present warns and ignores the numbered tables.
  • Numbered keys that don’t parse as positive integers (e.g. [line.foo]) warn and drop.
  • In multi-line mode with both [line].segments and [line.N] present, the numbered tables win and [line].segments is ignored. The spec’s edge-case table doesn’t enumerate this combination; this is a builder-level precedence choice matching the principle that single-line callers should go through build_segments.

Plugin segments can appear in at most one line per render: the shared plugin lookup is consumed on first use. A plugin id referenced again in a later line surfaces as “plugin ‘’ was rendered on an earlier line” so the user knows the cause is reuse, not a typo. v0.1 limitation; lifting it (Arc-shared or cloneable CompiledPlugin) is tracked separately.