pub fn parse_fixed(
text: &str,
digits: u8,
scale: u8,
at: usize,
) -> Result<FixedParts<'_>, WireError>Expand description
Split a fixed<P, S> value, refusing everything the declaration cannot
carry.
The one place the rule for a legal fixed value lives. Three call sites
had a copy of it before — this writer, zerodds-wire-codec’s encoder and
its canonical form — and a copy that disagreed with the others would
accept a value one path writes and another rejects, on the same sample.
What it refuses, and why each is a refusal and not a silent repair:
- A declaration outside IDL 4.2 rule (42):
Pof zero carries no digit to pair the sign nibble with,Pabove 31 has no packing defined, and anSwider thanPdescribes a fraction with no type to hold it. - A value that is not a decimal, or has no digits at all.
- An integer part wider than
P - S, or a fraction wider thanS. A truncated decimal is the wrong number with nothing to notice it by, which is the failurefixedexists to prevent.