pub trait ValidateLength<T>where
T: PartialEq + PartialOrd,{
// Required method
fn length(&self) -> Option<T>;
// Provided method
fn validate_length(
&self,
min: Option<T>,
max: Option<T>,
equal: Option<T>,
) -> bool { ... }
}
Expand description
Validates the length of the value given.
If the validator has equal
set, it will ignore any min
and max
value.
If you apply it on String, don’t forget that the length can be different from the number of visual characters for Unicode