Enum Address

Source
pub enum Address<'x> {
    Address(EmailAddress<'x>),
    Group(GroupedAddresses<'x>),
    List(Vec<Address<'x>>),
}
Expand description

RFC5322 address

Variants§

§

Address(EmailAddress<'x>)

§

Group(GroupedAddresses<'x>)

§

List(Vec<Address<'x>>)

Implementations§

Source§

impl<'x> Address<'x>

Source

pub fn new_address( name: Option<impl Into<Cow<'x, str>>>, email: impl Into<Cow<'x, str>>, ) -> Self

Create an RFC5322 e-mail address

Source

pub fn new_group( name: Option<impl Into<Cow<'x, str>>>, addresses: Vec<Address<'x>>, ) -> Self

Create an RFC5322 grouped e-mail address

Source

pub fn new_list(items: Vec<Address<'x>>) -> Self

Create an address list

Source

pub fn unwrap_address(&self) -> &EmailAddress<'x>

Trait Implementations§

Source§

impl<'x> Clone for Address<'x>

Source§

fn clone(&self) -> Address<'x>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'x> Debug for Address<'x>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'x> From<&'x str> for Address<'x>

Source§

fn from(value: &'x str) -> Self

Converts to this type from the input type.
Source§

impl<'x> From<(&'x str, &'x str)> for Address<'x>

Source§

fn from(value: (&'x str, &'x str)) -> Self

Converts to this type from the input type.
Source§

impl From<(String, String)> for Address<'_>

Source§

fn from(value: (String, String)) -> Self

Converts to this type from the input type.
Source§

impl<'x, T, U> From<(U, Vec<T>)> for Address<'x>
where T: Into<Address<'x>>, U: Into<Cow<'x, str>>,

Source§

fn from(value: (U, Vec<T>)) -> Self

Converts to this type from the input type.
Source§

impl<'x> From<Address<'x>> for HeaderType<'x>

Source§

fn from(value: Address<'x>) -> Self

Converts to this type from the input type.
Source§

impl From<String> for Address<'_>

Source§

fn from(value: String) -> Self

Converts to this type from the input type.
Source§

impl<'x, T> From<Vec<T>> for Address<'x>
where T: Into<Address<'x>>,

Source§

fn from(value: Vec<T>) -> Self

Converts to this type from the input type.
Source§

impl Header for Address<'_>

Source§

fn write_header( &self, output: impl Write, bytes_written: usize, ) -> Result<usize>

Source§

impl<'x> Ord for Address<'x>

Source§

fn cmp(&self, other: &Address<'x>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<'x> PartialEq for Address<'x>

Source§

fn eq(&self, other: &Address<'x>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'x> PartialOrd for Address<'x>

Source§

fn partial_cmp(&self, other: &Address<'x>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<'x> Eq for Address<'x>

Source§

impl<'x> StructuralPartialEq for Address<'x>

Auto Trait Implementations§

§

impl<'x> Freeze for Address<'x>

§

impl<'x> RefUnwindSafe for Address<'x>

§

impl<'x> Send for Address<'x>

§

impl<'x> Sync for Address<'x>

§

impl<'x> Unpin for Address<'x>

§

impl<'x> UnwindSafe for Address<'x>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.