diff --git a/jid/CHANGELOG.md b/jid/CHANGELOG.md index 0084f65..a252435 100644 --- a/jid/CHANGELOG.md +++ b/jid/CHANGELOG.md @@ -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 diff --git a/jid/src/lib.rs b/jid/src/lib.rs index ebed432..fa89863 100644 --- a/jid/src/lib.rs +++ b/jid/src/lib.rs @@ -105,6 +105,15 @@ impl From 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 for Jid { fn from(bare_jid: BareJid) -> Jid { Jid::Bare(bare_jid)