mehcode / config-rs

βš™οΈ Layered configuration system for Rust applications (with strong support for 12-factor applications).
Apache License 2.0
2.43k stars 206 forks source link

chore: Upgrade to `ron` to `0.9` #476

Open polarathene opened 8 months ago

polarathene commented 8 months ago

Changes


Note

  • Ron 0.9 is not yet released, but is expected to be this month.
  • This PR was prepared / tested via git dependency instead of version.

Relevance

I've had this sitting around for a while and meaning to push a PR before I forget πŸ˜…

This PR is an alternative to https://github.com/mehcode/config-rs/pull/472 and a sibling of https://github.com/mehcode/config-rs/pull/474

In particular Ron 0.9 is intended to be more robust with Value better supporting untagged enums and similar compatibility issues.

Ron 0.10 will continue to improve on the Value type, which may be relevant for config-rs.

polarathene commented 8 months ago

There is a YAML test with keys that are strings or numbers since the format supports that. Ron also supports this, but no equivalent test is present: https://github.com/mehcode/config-rs/issues/432

The YAML equivalent isn't exactly supported, config-rs just handles converting a number type to a string type for the map key. The same could be handled for Ron (and any other formats that support such), since lossless serialization / roundtripping isn't a goal of the crate, only deserializing into a config struct?

Awareness of the lossy deserialization could probably be better documented πŸ€·β€β™‚οΈ (similar is done for Char into String, number types too, while the new bytes variant isn't likely to be supported?)