Skip to main content

Module metric_format

Module metric_format 

Source
Expand description

SRD-40b §1 generation-time numeric sanitiser for synthetic metrics. Parses Excel-style hash-pattern format strings (#.##, 0.000) into a FormatSpec that the MetricsDispenser wrapper consults at registration time to derive a round operation applied before each cycle’s value is recorded on the instrument.

Excel-style only — printf-style (%3.2f) is not accepted, per SRD-40b’s “one syntax avoids two paths” rule. # and 0 placeholders are interchangeable for precision purposes (Excel’s render-time drop-trailing-zero distinction doesn’t apply here — we’re rounding the stored value, not rendering a string).

Structs§

FormatSpec
Compiled form of an SRD-40b format: declaration. The only field that matters at value-sanitiser time is decimal_places; the integer-side layout is recorded for diagnostic display but not enforced on the value.

Functions§

parse_format_spec
Parse an Excel-style hash-pattern format string.