[][src]Struct email_address::EmailAddress

pub struct EmailAddress(_);

Type representing a single email address. This is basically a wrapper around a String, the email address is parsed for correctness with FromStr::from_str, which is the only want to create an instance. The various components of the email are not parsed out to be accessible independently.

Methods

impl EmailAddress[src]

pub fn is_valid(address: &str) -> bool[src]

Determine whether the address string is a valid email address. Note this is equivalent to the following:

use email_address::*;
use std::str::FromStr;

let is_valid = EmailAddress::from_str("johnstonskj@gmail.com").is_ok();

pub fn is_valid_local_part(part: &str) -> bool[src]

Determine whether the part string would be a valid local-part if it were in an email address.

pub fn is_valid_domain(part: &str) -> bool[src]

Determine whether the part string would be a valid domain if it were in an email address.

pub fn to_uri(&self) -> String[src]

Return this email address formatted as a URI. This will also URI-encode the email address itself. So, name@example.org becomes mailto:name%40example.org.

pub fn to_display(&self, display_name: &str) -> String[src]

Return a string formatted as a display email with the user name. This is commonly used in email headers and other locations where a display name is associated with the address.

So, ("name@example.org", "My Name") becomes "My Name <name@example.org>".

Trait Implementations

impl Clone for EmailAddress[src]

impl Debug for EmailAddress[src]

impl<'de> Deserialize<'de> for EmailAddress[src]

impl Display for EmailAddress[src]

impl Eq for EmailAddress[src]

impl FromStr for EmailAddress[src]

type Err = Error

The associated error which can be returned from parsing.

impl Hash for EmailAddress[src]

impl PartialEq<EmailAddress> for EmailAddress[src]

impl Serialize for EmailAddress[src]

impl StructuralEq for EmailAddress[src]

impl StructuralPartialEq for EmailAddress[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.