xmpp: Implement FromStr for RoomNick

This commit is contained in:
xmppftw 2024-12-18 21:26:30 +01:00
parent f8347165fd
commit 48cb79b2d1

View file

@ -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<Self, Self::Err> {
Ok(Self::new(ResourcePart::new(s)?.into()))
}
}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
#[test] #[test]