pub struct Address {
pub inbox: Option<InboxId>,
pub user: UserId,
pub agent: AgentId,
}Fields§
§inbox: Option<InboxId>§user: UserId§agent: AgentIdImplementations§
Source§impl Address
impl Address
Sourcepub fn new(inbox: Option<InboxId>, user: UserId, agent: AgentId) -> Self
pub fn new(inbox: Option<InboxId>, user: UserId, agent: AgentId) -> Self
Creates a new address.
Sourcepub fn parse(input: impl AsRef<str>) -> Result<Self, Err>
pub fn parse(input: impl AsRef<str>) -> Result<Self, Err>
Parse an address from a string.
https://gitlab.com/relay-mail/docs/-/wikis/Architecture/Identity#address
General format: [inbox]#user@agent
§Example
use relay_core::id::{Address, AgentId, InboxId, UserId};
let address = Address::parse("work#alice.smith@example.com").unwrap();
assert_eq!(address.inbox, Some(InboxId::parse("work").unwrap()));
assert_eq!(address.user, UserId::parse("alice.smith").unwrap());
assert_eq!(address.agent, AgentId::parse("example.com").unwrap());Trait Implementations§
Source§impl<'de> Deserialize<'de> for Address
impl<'de> Deserialize<'de> for Address
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
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 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