pub struct LengthValidator {
pub min: Option<usize>,
pub max: Option<usize>,
pub exact: Option<usize>,
pub message: Option<String>,
}
Expand description
Validator for string/array length constraints
Fields§
§min: Option<usize>
Minimum length (inclusive)
max: Option<usize>
Maximum length (inclusive)
exact: Option<usize>
Exact length required
message: Option<String>
Custom error message
Implementations§
Trait Implementations§
Source§impl Clone for LengthValidator
impl Clone for LengthValidator
Source§fn clone(&self) -> LengthValidator
fn clone(&self) -> LengthValidator
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for LengthValidator
impl Debug for LengthValidator
Source§impl Default for LengthValidator
impl Default for LengthValidator
Source§impl ValidationRule for LengthValidator
impl ValidationRule for LengthValidator
Source§fn validate<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
value: &'life1 Value,
field: &'life2 str,
) -> Pin<Box<dyn Future<Output = ValidationResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn validate<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
value: &'life1 Value,
field: &'life2 str,
) -> Pin<Box<dyn Future<Output = ValidationResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Validate a single value
Source§fn parameters(&self) -> Option<Value>
fn parameters(&self) -> Option<Value>
Get validation rule parameters/configuration as JSON
Auto Trait Implementations§
impl Freeze for LengthValidator
impl RefUnwindSafe for LengthValidator
impl Send for LengthValidator
impl Sync for LengthValidator
impl Unpin for LengthValidator
impl UnwindSafe for LengthValidator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more