pub struct Validators;Expand description
Built-in validators implementation
Implementationsยง
Sourceยงimpl Validators
impl Validators
Sourcepub fn min_length(value: &FieldValue, min: usize) -> Result<(), String>
pub fn min_length(value: &FieldValue, min: usize) -> Result<(), String>
Check minimum length for strings
Sourcepub fn max_length(value: &FieldValue, max: usize) -> Result<(), String>
pub fn max_length(value: &FieldValue, max: usize) -> Result<(), String>
Check maximum length for strings
Sourcepub fn pattern(value: &FieldValue, pattern: &str) -> Result<(), String>
pub fn pattern(value: &FieldValue, pattern: &str) -> Result<(), String>
Validate against a regex pattern
Sourcepub fn postal_code(value: &FieldValue) -> Result<(), String>
pub fn postal_code(value: &FieldValue) -> Result<(), String>
Validate postal code format (basic)
Sourcepub fn credit_card(value: &FieldValue) -> Result<(), String>
pub fn credit_card(value: &FieldValue) -> Result<(), String>
Validate credit card number (Luhn algorithm)
Sourcepub fn positive(value: &FieldValue) -> Result<(), String>
pub fn positive(value: &FieldValue) -> Result<(), String>
Validate that value is a positive number
Sourcepub fn negative(value: &FieldValue) -> Result<(), String>
pub fn negative(value: &FieldValue) -> Result<(), String>
Validate that value is a negative number
Sourcepub fn array_length(
value: &FieldValue,
min: usize,
max: usize,
) -> Result<(), String>
pub fn array_length( value: &FieldValue, min: usize, max: usize, ) -> Result<(), String>
Validate array length
Auto Trait Implementationsยง
impl Freeze for Validators
impl RefUnwindSafe for Validators
impl Send for Validators
impl Sync for Validators
impl Unpin for Validators
impl UnsafeUnpin for Validators
impl UnwindSafe for Validators
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> 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 moreSourceยงimpl<T> SerializableKey for T
impl<T> SerializableKey for T
Sourceยงimpl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
Sourceยงfn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Borrows the value.
Sourceยงfn into_taken(self) -> T
fn into_taken(self) -> T
Takes the value.