From 48cb79b2d1f45efb4adda7e40913fd2b527c2f1c Mon Sep 17 00:00:00 2001 From: xmppftw Date: Wed, 18 Dec 2024 21:26:30 +0100 Subject: [PATCH] xmpp: Implement FromStr for RoomNick --- xmpp/src/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xmpp/src/lib.rs b/xmpp/src/lib.rs index 6ed7ce83..dc205a5f 100644 --- a/xmpp/src/lib.rs +++ b/xmpp/src/lib.rs @@ -77,6 +77,14 @@ impl fmt::Display for RoomNick { } } +impl core::str::FromStr for RoomNick { + type Err = crate::jid::Error; + + fn from_str(s: &str) -> Result { + Ok(Self::new(ResourcePart::new(s)?.into())) + } +} + #[cfg(test)] mod tests { #[test]