serde-bool
Single-side boolean deserializers.
Examples
Supporting serde untagged enums where only one boolean value is valid, allowing fallthrough to
the next variant. Avoids need to wrap all fields in Option<_> just in case feature is disabled.
// disabled variant is matched
let config = .unwrap;
assert!;
// if the type used `enabled: bool`, this would cause issues and require Option<_> wrappers plus
// further validation... instead an error is returned immediately regarding the missing fields
let config = .unwrap_err;
// using a `#[serde(default)]` annotation makes `enabled = true` optional here
let config = .unwrap;
assert!;
// extra keys can exists in the disabled case, but as usual will not be captured
let config = .unwrap;
assert!;