Closed juntyr closed 1 year ago
Patch coverage: 91.90%
and project coverage change: +1.07%
:tada:
Comparison is base (
3f877c2
) 82.95% compared to head (afd2ec0
) 84.02%.
:exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Manually checking the coverage shows that 100% of the patch seems to be covered
?r @torkleyy and @cart
One interesting detail for the future is that:
Value::Number
preserves the type of the suffixValue::Number
allows casting between types to occurIf we don't want this behaviour (in a future where roundtripping through Value
is possible and should produce the same errors), Value
would need to keep track of whether a prefix was used or not.
Fixes #241
This PR implements optional number type suffixes, which can be turned on with the
PrettyConfig::number_suffixes
option and are allowed during parsing. To allow Rusty suffixes to work with floating literals, this PR also finally allows using underscores in float literals, using the Rust syntax as a reference.This PR turned out to be significantly more work than I had anticipated. In particular, a number which could fit into the destination type, e.g.
1_u8
, now has to reject when deserialising into a typedu16
, since the type is an explicit mismatch. I tried my best to keep the changes in parsing small-ish and to use this opportunity to improve some error reporting a bit.For users of RON, this should be an unobservable change (apart from some error code changes which are now more meaningful). However, writing RON files can now be a bit more Rusty as types can be encoded explicitly and underscores can be used to make (long) number literals more readable. However, anyone serialising RON data should probably not turn the
PrettyConfig::number_suffixes
flag on unless they need lossless roundtrips throughValue::Number
variants, since explicit typing makes it harder to upgrade a format to different number types without breaking compatibility.CHANGELOG.md