pub struct ValidationRules {
pub rules: Vec<ValidationRule>,
pub field_name: String,
}Expand description
Container for multiple validation rules
Fields§
§rules: Vec<ValidationRule>§field_name: StringImplementations§
Source§impl ValidationRules
impl ValidationRules
Sourcepub fn add_rule(self, rule: ValidationRule) -> Self
pub fn add_rule(self, rule: ValidationRule) -> Self
Add a validation rule
Sourcepub fn validate_numeric<T>(&self, value: &T) -> Result<()>
pub fn validate_numeric<T>(&self, value: &T) -> Result<()>
Validate a numeric value against all rules
Sourcepub fn validate_string(&self, value: &str) -> Result<()>
pub fn validate_string(&self, value: &str) -> Result<()>
Validate a string value against all rules
Sourcepub fn validate_array<T>(&self, value: &[T]) -> Result<()>
pub fn validate_array<T>(&self, value: &[T]) -> Result<()>
Validate an array/vector against all rules
Sourcepub fn validate_usize(&self, value: &usize) -> Result<()>
pub fn validate_usize(&self, value: &usize) -> Result<()>
Validate an unsigned integer value (usize) against all rules
Trait Implementations§
Source§impl Clone for ValidationRules
impl Clone for ValidationRules
Source§fn clone(&self) -> ValidationRules
fn clone(&self) -> ValidationRules
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 moreAuto Trait Implementations§
impl Freeze for ValidationRules
impl !RefUnwindSafe for ValidationRules
impl Send for ValidationRules
impl Sync for ValidationRules
impl Unpin for ValidationRules
impl !UnwindSafe for ValidationRules
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more