Enum validator_types::Validator
source · [−]pub enum Validator {
Email,
Url,
Custom {
function: String,
argument: Box<Option<CustomArgument>>,
},
MustMatch(String),
Contains(String),
Regex(String),
Range {
min: Option<ValueOrPath<f64>>,
max: Option<ValueOrPath<f64>>,
},
Length {
min: Option<ValueOrPath<u64>>,
max: Option<ValueOrPath<u64>>,
equal: Option<ValueOrPath<u64>>,
},
Nested,
Required,
RequiredNested,
DoesNotContain(String),
}
Expand description
Contains all the validators that can be used
In this crate as it’s not allowed to export more than the proc macro in a proc macro crate
Variants
Email
Url
Custom
Fields
function: String
This is the name of the function that should be called
argument: Box<Option<CustomArgument>>
This is the argument type that can be passed in with a macro
MustMatch(String)
Contains(String)
Regex(String)
Range
Length
Nested
Required
RequiredNested
DoesNotContain(String)
Implementations
sourceimpl Validator
impl Validator
pub fn code(&self) -> &'static str
sourcepub fn get_custom_argument(&self) -> Option<&CustomArgument>
pub fn get_custom_argument(&self) -> Option<&CustomArgument>
This returns the defined custom argument if it was defined
sourcepub fn get_custom_argument_mut(&mut self) -> Option<&mut CustomArgument>
pub fn get_custom_argument_mut(&mut self) -> Option<&mut CustomArgument>
This returns the defined custom argument if it was defined
pub fn has_custom_argument(&self) -> bool
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Validator
impl !Send for Validator
impl !Sync for Validator
impl Unpin for Validator
impl UnwindSafe for Validator
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more