pub enum Address {
Mailbox(Mailbox),
Group(Group),
}Expand description
A single address item: either a mailbox or a group.
Deliberately not #[non_exhaustive]. RFC 5322 §3.4 closes the
address grammar to exactly mailbox / group; the kernel cannot
honestly add a third variant without an RFC update. The
derive-required exhaustive match lets downstream callers branch
on every variant without an _ => arm, useful when an extension
crate wants type-safe coverage of the address space.
Variants§
Implementations§
Trait Implementations§
Source§impl<'a> Arbitrary<'a> for Address
Available on crate feature arbitrary only.
impl<'a> Arbitrary<'a> for Address
Available on crate feature
arbitrary only.Source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Generate an arbitrary value of
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Generate an arbitrary value of
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Get a size hint for how many bytes out of an
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Get a size hint for how many bytes out of an
Unstructured this type
needs to construct itself. Read moreSource§impl<'de> Deserialize<'de> for Address
Available on crate feature serde only.
impl<'de> Deserialize<'de> for Address
Available on crate feature
serde only.Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for Address
Forwards to the underlying [Display for Mailbox] or
[Display for Group]; same UTF-8-direct caveat applies.
impl Display for Address
Forwards to the underlying [Display for Mailbox] or
[Display for Group]; same UTF-8-direct caveat applies.
Source§impl Extend<Address> for AddressList
impl Extend<Address> for AddressList
Source§fn extend<T: IntoIterator<Item = Address>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = Address>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl FromIterator<Address> for AddressList
impl FromIterator<Address> for AddressList
Source§impl JsonSchema for Address
Available on crate feature schemars only.
impl JsonSchema for Address
Available on crate feature
schemars only.Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl TryFrom<&str> for Address
impl TryFrom<&str> for Address
Source§fn try_from(value: &str) -> Result<Self, Self::Error>
fn try_from(value: &str) -> Result<Self, Self::Error>
Parses a single address (mailbox or group) from a string slice.
use email_message::Address;
let address = Address::try_from("jdoe@one.test").unwrap();
assert_eq!(address.to_string(), "jdoe@one.test");Source§type Error = AddressParseError
type Error = AddressParseError
The type returned in the event of a conversion error.
impl Eq for Address
impl StructuralPartialEq for Address
Auto Trait Implementations§
impl Freeze for Address
impl RefUnwindSafe for Address
impl Send for Address
impl Sync for Address
impl Unpin for Address
impl UnsafeUnpin for Address
impl UnwindSafe for Address
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