#[non_exhaustive]pub enum ValidatorKind {
EmailRfc,
E164Phone,
E164PhoneNational(Region),
Luhn,
IbanMod97,
Ipv4Parse,
Ipv6Parse,
EthEip55,
}Expand description
Closed set of validator implementations used by validator-backed recognizers.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
EmailRfc
Basic email shape validator.
E164Phone
Available on crate feature
phone-parser only.Parser-backed E.164 phone validator.
E164PhoneNational(Region)
Available on crate feature
phone-parser only.Parser-backed national phone validator for a fixed region.
Luhn
Luhn checksum validator.
IbanMod97
IBAN MOD-97 validator.
Ipv4Parse
Strict decimal dotted-quad IPv4 parser.
Ipv6Parse
RFC 4291 / RFC 5952 IPv6 textual parser.
EthEip55
EIP-55 Ethereum address checksum validator.
Implementations§
Source§impl ValidatorKind
impl ValidatorKind
Sourcepub fn parse(s: &str) -> Result<Self, ValidatorKindParseError>
pub fn parse(s: &str) -> Result<Self, ValidatorKindParseError>
Parses a policy validator kind.
Sourcepub fn validate(self, input: &str) -> ValidatorOutcome
pub fn validate(self, input: &str) -> ValidatorOutcome
Applies validation and returns a typed outcome for audit.
Sourcepub fn canonical_form(self, input: &str) -> Option<String>
pub fn canonical_form(self, input: &str) -> Option<String>
Returns the canonical form for accepted input.
Sourcepub fn fail_reason(self) -> ValidatorFailReason
pub fn fail_reason(self) -> ValidatorFailReason
Returns the audit reason emitted when validation fails.
Trait Implementations§
Source§impl Clone for ValidatorKind
impl Clone for ValidatorKind
Source§fn clone(&self) -> ValidatorKind
fn clone(&self) -> ValidatorKind
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ValidatorKind
impl Debug for ValidatorKind
Source§impl PartialEq for ValidatorKind
impl PartialEq for ValidatorKind
Source§fn eq(&self, other: &ValidatorKind) -> bool
fn eq(&self, other: &ValidatorKind) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for ValidatorKind
impl Eq for ValidatorKind
impl StructuralPartialEq for ValidatorKind
Auto Trait Implementations§
impl Freeze for ValidatorKind
impl RefUnwindSafe for ValidatorKind
impl Send for ValidatorKind
impl Sync for ValidatorKind
impl Unpin for ValidatorKind
impl UnsafeUnpin for ValidatorKind
impl UnwindSafe for ValidatorKind
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