confval v0.13.0
A required field can now supply a value for the generated Default impl, without becoming optional in a document. This lets a spec with required fields drop its handwritten impl Default, which repeated the attribute defaults and could drift from them. See the parsing guide for details.
Highlights
- A field that must be set in a document can now carry a default for the generated
Defaultimpl, via#[confval(derive_default = expr)]. - Specs with required fields can drop their handwritten
impl Default.
Added
#[confval(derive_default = expr)]on a field of a#[confval(derive_default)]struct. The field stays required in parsing.
Upgrading
If you keep a handwritten impl Default that repeats attribute defaults, you can delete it and use #[confval(derive_default = expr)] on each required field instead. Fields using the new attribute stay required in a document, so no parsed document changes.
[dependencies]
confval = { version = "0.13", features = ["derive", "hcl", "color"] }