pub struct EmailValidator {
pub message: Option<String>,
pub allow_unicode: bool,
pub require_tld: bool,
pub custom_pattern: Option<Regex>,
}
Expand description
Validator for email address format
Fields§
§message: Option<String>
Custom error message
allow_unicode: bool
Allow international domain names
require_tld: bool
Require TLD (top-level domain)
custom_pattern: Option<Regex>
Custom regex pattern (overrides default)
Implementations§
Source§impl EmailValidator
impl EmailValidator
Sourcepub fn allow_unicode(self, allow: bool) -> Self
pub fn allow_unicode(self, allow: bool) -> Self
Allow unicode characters in domain names (internationalized domains)
Sourcepub fn require_tld(self, require: bool) -> Self
pub fn require_tld(self, require: bool) -> Self
Require top-level domain (e.g., .com, .org)
Sourcepub fn custom_pattern(self, pattern: Regex) -> Self
pub fn custom_pattern(self, pattern: Regex) -> Self
Use custom regex pattern for validation
Trait Implementations§
Source§impl Clone for EmailValidator
impl Clone for EmailValidator
Source§fn clone(&self) -> EmailValidator
fn clone(&self) -> EmailValidator
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 EmailValidator
impl Debug for EmailValidator
Source§impl Default for EmailValidator
impl Default for EmailValidator
Source§impl ValidationRule for EmailValidator
impl ValidationRule for EmailValidator
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 EmailValidator
impl RefUnwindSafe for EmailValidator
impl Send for EmailValidator
impl Sync for EmailValidator
impl Unpin for EmailValidator
impl UnwindSafe for EmailValidator
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