Open dtolnay opened 7 years ago
The default
support does look interesting, at the moment what I'm doing is using the whole default config struct and apply the generic toml::Table
values on top of it (https://github.com/bfil/toml-config/blob/master/src/lib.rs#L192).
When I have some time I'll bump to the latest version of serde
and will try to flip things around and see if it would be possible to remove the apply_overrides
method altogether, it would be nice and it would pretty much make this library almost pointless (apart from the rustc_serialize
/serde
feature switch support).
I'll have a play around when I can and see if there's anything else that could be necessary or nice to have, but I doubt it because it's pretty much the core of what this library does.
https://github.com/serde-rs/serde/pull/780 added support for a
#[serde(default)]
attribute on structs to use the Default implementation of the struct to fill in any missing fields.The example from the toml-config rustdoc would look something like:
Is there any other functionality of this crate that you think may be helpful for us to expose directly in Serde so that it applies consistently across all data formats?