xmpp: Implement FromStr for RoomNick
This commit is contained in:
parent
f8347165fd
commit
48cb79b2d1
1 changed files with 8 additions and 0 deletions
|
@ -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]
|
||||||
|
|
Loading…
Reference in a new issue