Implement From<&Jid> for String (close #69)

This commit is contained in:
xmppftw 2023-05-28 20:02:09 +02:00
parent ce255d9602
commit 8d9288ffd7
2 changed files with 11 additions and 0 deletions

View file

@ -2,6 +2,8 @@ Unreleased
* Breaking
- serde: Jid is now using untagged enum representation (#66)
* Additions
- From<&Jid> is now implemented for String (#69)
Version 0.9.3, release 2022-03-07:
* Updates

View file

@ -105,6 +105,15 @@ impl From<Jid> for String {
}
}
impl From<&Jid> for String {
fn from(jid: &Jid) -> String {
match jid {
Jid::Bare(bare) => String::from(bare),
Jid::Full(full) => String::from(full),
}
}
}
impl From<BareJid> for Jid {
fn from(bare_jid: BareJid) -> Jid {
Jid::Bare(bare_jid)