Expand description
Number text (RULES.md §12): a provider’s number reaches the reply with
the provider’s own spelling.
A runner that decodes a number into binary floating point and encodes
it again can change its spelling (0.10 becomes 0.1, 1E+30 becomes
1e30) and, past 17 significant digits, its value. Callers threshold on these numbers, so a role keeps
the text: each known numeric member is a NumberText, serde_json’s
RawValue, which holds the exact bytes the provider sent.
The serde_json features arbitrary_precision and float_roundtrip
would also keep spellings, but they change number parsing for every
crate in a workspace build. No role crate enables them.
Functions§
- is_
number_ literal - Whether
textis one JSON number literal: an optional-, an integer part without leading zeros, an optional fraction and an optional exponent, with no surrounding whitespace. - is_
number_ text - Whether
rawholds one JSON number. - number_
text textas number text, or why it is not one JSON number literal.- number_
text_ of numberas number text, in serde_json’s spelling of it. For building a value a runner computed itself; a provider’s number is kept as it came.- same_
text - Whether two optional raw values hold the same text.
Type Aliases§
- Number
Text - A JSON value kept as the exact text it arrived as.