Expand description
Magnitude-suffix-aware numeric coercion for workload parameters.
A workload param declares its TYPE through the inferred type of its
default value (max_size: 1000000 → u64). The declared default is
the source of truth: when a CLI override supplies that param, the
override is coerced to the default’s numeric type rather than being
allowed to flip it to a string. The coercion understands magnitude
suffixes, so max_size=10m means ten million:
- decimal (powers of 1000):
k M G B T P E(B= billion =G), - binary (powers of 1024):
Ki Mi Gi Ti Pi Ei.
Suffixes are case-insensitive. A value that is already a plain
number, or whose declared default is non-numeric, is returned
unchanged — so a genuine string param (e.g. a glob like 100m) is
never numified.
Functions§
- coerce_
param_ override - Coerce a CLI override to the type inferred from a param’s declared
default. When the default is numeric (
u64orf64) the override is parsed withparse_magnitudeand re-emitted as a canonical numeric literal (integer for au64default, float for anf64default). A non-numeric default, an already-plain-numeric override, or an unparseable override is returned unchanged (so the value, or any downstream type error, names exactly what the operator typed). - parse_
magnitude - Parse a numeric string with an optional magnitude suffix into
f64. ReturnsNoneif the string is not<number>[suffix].