You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For the time being, you can use a custom validator which just wraps rules::length:
#[derive(garde::Validate)]structTest{// min max// v v#[garde(custom(|v, _| garde::rules::length::apply(v,(2,2))))]field:String,}// or as a reusable one:fnlen_eq_2<T: garde::rules::length::Length>(v:&T, _:&()) -> garde::Result{
garde::rules::length::apply(v,(2,2))}#[derive(Debug, garde::Validate)]structTest2{#[garde(custom(len_eq_2))]field:String,}
Thank you for this crate. I really appreciate the
validator
crate too.I'm getting an error with this crate when a length's
min
andmax
are set to the same value.I would like for this field to be exactly 2 characters, no more and no less.
If this is invalid, how would I express in this in
garde
without a custom rule? Or maybe this is an oversight?Thank you for the crate and your help!
The text was updated successfully, but these errors were encountered: