#[non_exhaustive]pub struct AddressGroup {
pub name: Option<String>,
pub addresses: Vec<EmailAddress>,
}Expand description
A group of EmailAddress values, optionally named.
Mirrors the JMAP EmailAddressGroup object defined in RFC 8621 §4.1.2.4.
Per RFC 8621 §4.1.2.4, consecutive mailboxes that are not part of a
declared RFC 5322 group are still collected under an AddressGroup
whose name is None, “to provide a uniform type”.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: Option<String>Display name of the group, or None for ungrouped mailboxes.
Parser-produced values follow the same normalisation as
EmailAddress::name: surrounding ASCII whitespace trimmed; an
empty result is mapped to None, not Some(String::new()).
addresses: Vec<EmailAddress>Mailboxes belonging to this group.
Implementations§
Source§impl AddressGroup
impl AddressGroup
Sourcepub fn new(name: Option<String>, addresses: Vec<EmailAddress>) -> Self
pub fn new(name: Option<String>, addresses: Vec<EmailAddress>) -> Self
Construct an AddressGroup from an optional group name and a
vector of mailboxes.
AddressGroup is #[non_exhaustive] so external callers cannot
use struct expression syntax. Use this constructor — or
Default::default() followed by field assignment — instead.
Trait Implementations§
Source§impl Clone for AddressGroup
impl Clone for AddressGroup
Source§fn clone(&self) -> AddressGroup
fn clone(&self) -> AddressGroup
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AddressGroup
impl Debug for AddressGroup
Source§impl Default for AddressGroup
impl Default for AddressGroup
Source§fn default() -> AddressGroup
fn default() -> AddressGroup
Source§impl<'de> Deserialize<'de> for AddressGroup
impl<'de> Deserialize<'de> for AddressGroup
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>,
Source§impl Display for AddressGroup
impl Display for AddressGroup
Source§fn fmt(&self, f: &mut Formatter<'_>) -> Result
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Render in RFC 5322 §3.4 group form: name: mb1, mb2;.
- Named group:
Friends: alice@example.com, bob@example.com;. - Anonymous group (
name == None): just the comma-joined mailbox list, no:and no terminating;. - Empty group: just
name:;(or empty string for an anonymous empty group).
Same caveat as EmailAddress Display: prioritises human
readability; not guaranteed RFC 5322 round-trippable.
impl Eq for AddressGroup
Source§impl Hash for AddressGroup
impl Hash for AddressGroup
Source§impl PartialEq for AddressGroup
impl PartialEq for AddressGroup
Source§fn eq(&self, other: &AddressGroup) -> bool
fn eq(&self, other: &AddressGroup) -> bool
self and other values to be equal, and is used by ==.