Skip to main content

AddressLiteral

Enum AddressLiteral 

Source
pub enum AddressLiteral {
    Reject,
    Routable,
    Rfc5321,
}
Expand description

Which address-literal spellings the domain may take (RFC 5321 §4.1.3).

The grammar names three alternatives:

address-literal = "[" ( IPv4-address-literal /
                        IPv6-address-literal /
                        General-address-literal ) "]"

A domain literal is refused unless asked for, so the default is Reject. Of the two readings a caller can opt into, the destination-oriented one, Routable, covers the first two alternatives, which are the only ones mail can be delivered to. A reader of an identity rather than a destination needs the third: an X.509 rfc822Name is a Mailbox as RFC 5321 defines it (RFC 5280 §4.2.1.6), and refusing a spelling the grammar names makes the certificate carrying it unreadable rather than merely unroutable.

Variants§

§

Reject

Reject every [...] domain literal.

§

Routable

Accept only a literal naming a routable destination: an IPv4 dotted-quad or an IPv6:-tagged IPv6 address.

Stricter than the grammar in one place, deliberately: RFC 5321 Snum is 1*3DIGIT in the range 0..=255 with no rule against padding, so [012.0.2.1] is inside the grammar. It is rejected here because a zero-padded octet is read as octal by some resolvers, and a destination that resolves two ways is not one. Use Rfc5321 to read the grammar as written.

§

Rfc5321

Accept every alternative the grammar names, General-address-literal included, so postmaster@[AS400:QSYS] parses.

General-address-literal = Standardized-tag ":" 1*dcontent
Standardized-tag        = Ldh-str
dcontent                = %d33-90 / %d94-126

The IPv6 tag keeps its own alternative’s meaning: RFC 5321 §4.1.3 requires a standardized tag to be defined by a Standards-Track RFC, and IPv6 is, so [IPv6:...] must still hold an IPv6 address and is not reinterpreted as free dcontent.

Trait Implementations§

Source§

impl Clone for AddressLiteral

Source§

fn clone(&self) -> AddressLiteral

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for AddressLiteral

Source§

impl Debug for AddressLiteral

Source§

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

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

impl Default for AddressLiteral

Source§

fn default() -> AddressLiteral

Returns the “default value” for a type. Read more
Source§

impl Eq for AddressLiteral

Source§

impl PartialEq for AddressLiteral

Source§

fn eq(&self, other: &AddressLiteral) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for AddressLiteral

Auto Trait Implementations§

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 = !

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.