Skip to main content

ReportItem

Struct ReportItem 

Source
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: Kind

plot or table.

§name: String

Canonical 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: Style

Per-item style overrides parsed from the directive body.

§body: String

Raw 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: bool

Plot-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

Source

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).

Trait Implementations§

Source§

impl Clone for ReportItem

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ReportItem

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for ReportItem

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ReportItem

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for ReportItem

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.