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) -> Address
pub fn new(inbox: Option<InboxId>, user: UserId, agent: AgentId) -> Address
Creates a new address.
Sourcepub fn parse(input: impl AsRef<str>) -> Result<Address, IdentityError>
pub fn parse(input: impl AsRef<str>) -> Result<Address, IdentityError>
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<Address, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Address, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for Address
impl Serialize for Address
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. 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