pub struct EmailAddress { /* private fields */ }Expand description
Validated email address text split into local and domain parts.
Implementations§
Source§impl EmailAddress
impl EmailAddress
Sourcepub fn new(
value: impl AsRef<str>,
) -> Result<EmailAddress, AddressValidationError>
pub fn new( value: impl AsRef<str>, ) -> Result<EmailAddress, AddressValidationError>
Creates an address using practical validation.
Sourcepub fn new_with_mode(
value: impl AsRef<str>,
mode: AddressValidationMode,
) -> Result<EmailAddress, AddressValidationError>
pub fn new_with_mode( value: impl AsRef<str>, mode: AddressValidationMode, ) -> Result<EmailAddress, AddressValidationError>
Creates an address using the requested validation mode.
Sourcepub fn from_parts(
local_part: impl AsRef<str>,
domain_part: impl AsRef<str>,
) -> Result<EmailAddress, AddressValidationError>
pub fn from_parts( local_part: impl AsRef<str>, domain_part: impl AsRef<str>, ) -> Result<EmailAddress, AddressValidationError>
Creates an address from already separated local and domain text.
Sourcepub fn from_parts_with_mode(
local_part: impl AsRef<str>,
domain_part: impl AsRef<str>,
mode: AddressValidationMode,
) -> Result<EmailAddress, AddressValidationError>
pub fn from_parts_with_mode( local_part: impl AsRef<str>, domain_part: impl AsRef<str>, mode: AddressValidationMode, ) -> Result<EmailAddress, AddressValidationError>
Creates an address from separated parts using the requested validation mode.
Sourcepub const fn local_part(&self) -> &LocalPart
pub const fn local_part(&self) -> &LocalPart
Returns the local part.
Sourcepub const fn domain_part(&self) -> &DomainPart
pub const fn domain_part(&self) -> &DomainPart
Returns the domain part.
Sourcepub fn into_string(self) -> String
pub fn into_string(self) -> String
Returns an owned address string.
Trait Implementations§
Source§impl Clone for EmailAddress
impl Clone for EmailAddress
Source§fn clone(&self) -> EmailAddress
fn clone(&self) -> EmailAddress
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 EmailAddress
impl Debug for EmailAddress
Source§impl Display for EmailAddress
impl Display for EmailAddress
Source§impl From<EmailAddress> for EnvelopeAddress
impl From<EmailAddress> for EnvelopeAddress
Source§fn from(value: EmailAddress) -> EnvelopeAddress
fn from(value: EmailAddress) -> EnvelopeAddress
Converts to this type from the input type.
Source§impl FromStr for EmailAddress
impl FromStr for EmailAddress
Source§type Err = AddressValidationError
type Err = AddressValidationError
The associated error which can be returned from parsing.
Source§fn from_str(value: &str) -> Result<EmailAddress, <EmailAddress as FromStr>::Err>
fn from_str(value: &str) -> Result<EmailAddress, <EmailAddress as FromStr>::Err>
Parses a string
s to return a value of this type. Read moreSource§impl Hash for EmailAddress
impl Hash for EmailAddress
Source§impl Ord for EmailAddress
impl Ord for EmailAddress
Source§fn cmp(&self, other: &EmailAddress) -> Ordering
fn cmp(&self, other: &EmailAddress) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for EmailAddress
impl PartialEq for EmailAddress
Source§fn eq(&self, other: &EmailAddress) -> bool
fn eq(&self, other: &EmailAddress) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd for EmailAddress
impl PartialOrd for EmailAddress
Source§impl TryFrom<&str> for EmailAddress
impl TryFrom<&str> for EmailAddress
Source§type Error = AddressValidationError
type Error = AddressValidationError
The type returned in the event of a conversion error.
Source§fn try_from(
value: &str,
) -> Result<EmailAddress, <EmailAddress as TryFrom<&str>>::Error>
fn try_from( value: &str, ) -> Result<EmailAddress, <EmailAddress as TryFrom<&str>>::Error>
Performs the conversion.
impl Eq for EmailAddress
impl StructuralPartialEq for EmailAddress
Auto Trait Implementations§
impl Freeze for EmailAddress
impl RefUnwindSafe for EmailAddress
impl Send for EmailAddress
impl Sync for EmailAddress
impl Unpin for EmailAddress
impl UnsafeUnpin for EmailAddress
impl UnwindSafe for EmailAddress
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