pub struct ReportItem {
pub kind: Kind,
pub name: String,
pub label: Option<String>,
pub as_stem: Option<String>,
pub style: Style,
pub body: String,
pub target_file: Option<String>,
pub order: Option<usize>,
pub with_table: bool,
pub with_tables: Vec<String>,
}Expand description
One renderable report item — either a plot or a table.
Fields§
§kind: Kindplot or table.
name: StringCanonical name (the token after plot / table).
label: Option<String>Display label (label "..."). Falls back to a prettified
form of name when absent.
as_stem: Option<String>Output-filename stem (as <stem>). When absent, default
is plot_<name> / table_<name> derived at render time.
style: StylePer-item style overrides parsed from the directive body.
body: StringRaw spec body — the directive lines following the
<kind> <name> line, with as/label/style directives
stripped out (they live on the ReportItem / Style
fields). Renderers parse this exactly the way they parse
the legacy CLI spec strings.
target_file: Option<String>Output file this item flows into when the markdown
assembler runs. None ⇒ default summary.md. Set by a
preceding file <filename> directive in the same group.
Resolved at parse time so consumers don’t need to walk
the group order.
order: Option<usize>Declaration ordinal across the whole report: block,
stamped by parse_report and persisted as an
order <n> directive line, so a db-sourced render
(report.<name> metadata rows, which iterate in key
order) can restore declaration order. serde(skip):
positional metadata derived at parse, not document
content.
with_table: boolPlot-only directive: when true, the renderer
emits a companion table immediately after the plot
in the same markdown file, sharing the plot’s
underlying query data. The companion table reuses
the plot’s name with a _table suffix for its
anchor and figure-numbering slot, so users can
link to either view independently.
Set via with-table: true in the plot’s body.
No-op for Kind::Table and other non-plot items.
Default false — plots without an explicit toggle
keep their existing single-image behaviour.
with_tables: Vec<String>Plot-only directive: when non-empty, the renderer emits one companion table per distinct value tuple of the listed label keys. Each table is filtered to rows whose labels match that tuple, and gets its own markdown section / standalone file named with the tuple values appended.
Set via with-tables: [label1, label2, …] in the
plot body. Independent of (and composes with)
with-table: true — the singular form still emits
a single un-faceted table when set.
Implementations§
Source§impl ReportItem
impl ReportItem
Sourcepub fn to_yaml_directive_string(&self) -> String
pub fn to_yaml_directive_string(&self) -> String
Render this item back to its canonical YAML directive
form — the same string shape the workload-YAML parser
in [parse_group] consumes. Round-trips:
parse_group(... item.to_yaml_directive_string() ...) == item.
The output is one or more lines:
plot <name>
as <stem>
label "<label>"
palette=<v>
line=<v> width=<n> marker=<v> size=<n> color=<#hex>
<body lines verbatim>
series <key>=<val> {<json>}Order matches vocab::ALL_DIRECTIVES so the
round-trip is stable. Style fields that are None are
omitted; the body is appended verbatim (it carries the
renderer-consumed over / by / where / agg /
xlabel / etc. lines).