Open MhhhxX opened 1 year ago
Hi! Thanks for your report! Changing the config-rs implementation to support non-String keys would be (to my knowlegde) a big undertaking. I am not sure whether it can be done at all, at least not without major refactoring of the crate I guess. I hope I can incorporate this into my config-rs-ng efforts...
FWIW, I think you'll find deserializing some formats (notably Ron) will be lossy as the format is not deserializing directly into your config struct but being normalized through an intermediary storage.
Supporting the other native rust number formats and types/primitives is probably quite doable vs the Map key concern.
I have found that deserialising maps with this crate works differently from the deserialisation function of the ron crate.
I have taken the map from the example ron file available on the ron github page. With this I have extended the test for the ron format in my own fork of this repo.
And unfortunately the test fails with the following error:
From the error message I conclude that
config-rs
only supports string keys for maps while the specification ofron
also allows non-string keys in maps. You can check the allowed types for map keys here. The type of a map key isvalue
which you can see here.I think it would be nice if this crate would also align in that case with the original specification of ron as it caused some troubles for me.
Update: I just found out that you're already working on making the library more flexible in another repository. That's great news. Can't wait to test it when it's ready!