pub enum ValidationRule {
Required,
Range {
min: Option<f64>,
max: Option<f64>,
},
Length {
min: Option<usize>,
max: Option<usize>,
},
Pattern(String),
Email,
Url,
PhoneNumber {
country: PhoneCountry,
},
Date {
min: Option<NaiveDate>,
max: Option<NaiveDate>,
},
Time {
min: Option<NaiveTime>,
max: Option<NaiveTime>,
},
CreditCard,
Custom {
name: String,
validator: fn(&FieldValue) -> bool,
},
}Expand description
Validation rules
Variants§
Required
Field is required
Range
Numeric range validation
Length
String length validation
Pattern(String)
Regular expression pattern
Email validation
Url
URL validation
PhoneNumber
Phone number validation
Fields
§
country: PhoneCountryDate
Date validation
Time
Time validation
CreditCard
Credit card validation
Custom
Custom validation function
Trait Implementations§
Source§impl Clone for ValidationRule
impl Clone for ValidationRule
Source§fn clone(&self) -> ValidationRule
fn clone(&self) -> ValidationRule
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 ValidationRule
impl RefUnwindSafe for ValidationRule
impl Send for ValidationRule
impl Sync for ValidationRule
impl Unpin for ValidationRule
impl UnwindSafe for ValidationRule
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