Skip to main content

Module report

Module report 

Source
Expand description

Unified report: block — plots and tables under one schema.

See SRD-46 (docs/SRD/46_reports.md) for the authoritative design. This module owns:

  • The data model: Report / ReportGroup / ReportItem / Kind / Style.
  • The directive-string tokenizer that splits a group’s body into items keyed by leading plot <name> / table <name>.
  • The JSON sub-block parser for series ... {…} style overrides (strict JSON only — relies on the existing rule that Polydat {...} is unambiguously not JSON).
  • Style cascade helpers: defaults at workload root, defaults at group level, then per-item directives.

The crate is parser-only. Renderers in nmbrs/src/plot_metrics.rs and the corresponding table renderer consume ReportItem.body plus the resolved Style — they don’t touch the raw YAML again.

Re-exports§

pub use vocab::AGG_FNS;
pub use vocab::ALL_DIRECTIVES;
pub use vocab::AXIS_SCALES;
pub use vocab::Directive;
pub use vocab::DirectiveTarget;
pub use vocab::KindMask;
pub use vocab::LINE_STYLES;
pub use vocab::MARKER_SHAPES;
pub use vocab::PALETTE_NAMES;
pub use vocab::ValueProvider;
pub use vocab::YamlForm;
pub use vocab::cli_flags_for;
pub use vocab::directive_by_cli_flag;
pub use vocab::directive_by_yaml_keyword;
pub use vocab::directives_for;

Modules§

vocab
Single source of truth for the report grammar’s lexical vocabulary — directives, their CLI flag mapping, and the valid value space for each.

Structs§

ParsedReport
Result of parsing a report: block. Warnings are non-fatal in normal mode; callers running under SRD-15 strict mode should promote them to errors.
Report
Top-level report: block.
ReportGroup
One named container in report:. Holds zero or more items plus group-level defaults.
ReportItem
One renderable report item — either a plot or a table.
SeriesOverride
One series <key>=<value> {...} directive.
Style
Style and figure-metadata bag. Every field optional; cascade is “first non-None wins outer-to-inner”.

Enums§

Destination
SRD-46 output destination for a rendered report item.
Kind
Kind discriminator. Identifies which renderer owns the item.

Functions§

parse_persisted_item
Parse a single persisted-form report item — header line (<kind> <name>) followed by indented directive lines, as produced by ReportItem::to_yaml_directive_string. Used by the session-db fallback path in nmbrs report so the directive-form knowledge lives in one place.
parse_report
Parse a report: value (a YAML mapping) into a Report.