v0.15.0
Breaking changes
garde::error
has been completely overhauled.garde::Validate
has a newvalidate_into
method, which is the primary entrypoint for custom implementations now.garde::Validate::validate
is now implemented by default by callingvalidate_into
.
These changes should not have any significant effects on the usage of the library, if all you're doing is deriving Validate
and serializing errors using the Display
implementation on Errors
(now called Report
). If you're having trouble migrating, please open an issue.
New features
You can now easily select!
errors for specific fields on a given Report
:
#[derive(garde::Validate)]
struct Foo<'a> {
#[garde(dive)]
bar: Bar<'a>,
}
#[derive(garde::Validate)]
struct Bar<'a> {
#[garde(length(min = 1))]
value: &'a str,
}
let v = Foo { bar: Bar { value: "" } };
let report = v.validate(&()).unwrap_err();
println!("errors for `Foo.bar.value`");
for error in garde::error::select!(report, bar.value) {
println!("{error}");
}
Pull requests
- Flat error representation by @jprochazk in #67
Full Changelog: v0.14.1...v0.15.0