pub struct Email { /* private fields */ }Expand description
An address: trimmed, lower-cased (mb_strtolower) and split at its
single @. It can hold any bytes, as a PHP string does.
Implementations§
Source§impl Email
impl Email
Sourcepub fn new(input: impl AsRef<[u8]>) -> Result<Self, Error>
pub fn new(input: impl AsRef<[u8]>) -> Result<Self, Error>
Parses an address.
§Errors
Error::Parse for an empty address (or "0"), or one without
exactly one @ and something (not "0") on both sides of it.
PHP: new Email($email), up to new Domain() of its domain.
Sourcepub fn has_valid_local(&self) -> bool
pub fn has_valid_local(&self) -> bool
Whether the local part has at most LOCAL_MAX_LENGTH characters,
all of [a-zA-Z0-9._+-], no .., and no dot at either end.
PHP: hasValidLocal().
Sourcepub fn has_valid_domain_syntax(&self) -> bool
pub fn has_valid_domain_syntax(&self) -> bool
Whether the domain has at most DOMAIN_MAX_LENGTH characters and
PHP’s email filter accepts it after test@. hasValidDomain() then
also asks that the domain be known or a test domain.
PHP: hasValidDomain(), up to $this->domainInstance->isKnown().
Sourcepub fn canonical(&self) -> Result<Canonical, Error>
pub fn canonical(&self) -> Result<Canonical, Error>
The address with the aliases of its provider removed.
§Errors
Error::EmptyLocal (see Provider::canonical).
PHP: getCanonical().
Sourcepub fn is_canonical_supported(&self) -> bool
pub fn is_canonical_supported(&self) -> bool
Whether one of PROVIDERS has the domain.
PHP: isCanonicalSupported().
Sourcepub fn canonical_domain(&self) -> Option<&'static str>
pub fn canonical_domain(&self) -> Option<&'static str>
The canonical domain of the provider of PROVIDERS that has the
domain, if one does.
PHP: getCanonicalDomain().
Trait Implementations§
impl Eq for Email
impl StructuralPartialEq for Email
Auto Trait Implementations§
impl Forget for Email
impl Freeze for Email
impl Move for Email
impl RefUnwindSafe for Email
impl Send for Emailwhere
RawVecInner: Send,
impl Sync for Emailwhere
RawVecInner: Sync,
impl Unpin for Email
impl UnsafeUnpin for Email
impl UnwindSafe for Emailwhere
RawVecInner: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.