Skip to main content

parse_precision_meta

Function parse_precision_meta 

Source
pub fn parse_precision_meta(value: &MetaValue) -> Result<u32, String>
Expand description

Try to interpret a MetaValue as a non-negative integer ≤ u32::MAX.

Used by the precision metadata feature on commodity directives (issue #991). Shared between the loader (which silently skips invalid values and falls back to inferred precision) and the validator (which surfaces the problem as an InvalidPrecisionMetadata warning), so both paths agree on what counts as valid.

§Errors

Returns a human-readable explanation when the value is not a number, is negative, has a fractional part, or is out of u32 range.