diff options
Diffstat (limited to 'stanza/src/client/presence.rs')
-rw-r--r-- | stanza/src/client/presence.rs | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/stanza/src/client/presence.rs b/stanza/src/client/presence.rs index a8c35d0..b0a0bc0 100644 --- a/stanza/src/client/presence.rs +++ b/stanza/src/client/presence.rs @@ -1,10 +1,7 @@ use std::str::FromStr; use jid::JID; -use peanuts::{ - element::{FromElement, IntoElement}, - DeserializeError, Element, XML_NS, -}; +use peanuts::{DeserializeError, Element, FromElement, IntoElement, XML_NS}; #[cfg(feature = "xep_0115")] use crate::xep_0115::C; @@ -41,7 +38,7 @@ pub struct Presence { } impl FromElement for Presence { - fn from_element(mut element: Element) -> peanuts::element::DeserializeResult<Self> { + fn from_element(mut element: Element) -> peanuts::DeserializeResult<Self> { element.check_name("presence")?; element.check_namespace(XMLNS)?; @@ -91,7 +88,7 @@ impl FromElement for Presence { } impl IntoElement for Presence { - fn builder(&self) -> peanuts::element::ElementBuilder { + fn builder(&self) -> peanuts::ElementBuilder { let builder = Element::builder("presence", Some(XMLNS)) .push_attribute_opt("from", self.from.clone()) .push_attribute_opt("id", self.id.clone()) @@ -174,7 +171,7 @@ pub enum Show { } impl FromElement for Show { - fn from_element(mut element: Element) -> peanuts::element::DeserializeResult<Self> { + fn from_element(mut element: Element) -> peanuts::DeserializeResult<Self> { element.check_name("show")?; element.check_namespace(XMLNS)?; @@ -197,7 +194,7 @@ impl FromStr for Show { } impl IntoElement for Show { - fn builder(&self) -> peanuts::element::ElementBuilder { + fn builder(&self) -> peanuts::ElementBuilder { Element::builder("show", Some(XMLNS)).push_text(*self) } } @@ -220,7 +217,7 @@ pub struct Status { } impl FromElement for Status { - fn from_element(mut element: Element) -> peanuts::element::DeserializeResult<Self> { + fn from_element(mut element: Element) -> peanuts::DeserializeResult<Self> { element.check_name("status")?; element.check_namespace(XMLNS)?; @@ -232,7 +229,7 @@ impl FromElement for Status { } impl IntoElement for Status { - fn builder(&self) -> peanuts::element::ElementBuilder { + fn builder(&self) -> peanuts::ElementBuilder { Element::builder("status", Some(XMLNS)) .push_attribute_opt_namespaced(XML_NS, "lang", self.lang.clone()) .push_text(self.status.clone()) @@ -263,7 +260,7 @@ impl ToString for String1024 { pub struct Priority(pub i8); impl FromElement for Priority { - fn from_element(mut element: peanuts::Element) -> peanuts::element::DeserializeResult<Self> { + fn from_element(mut element: peanuts::Element) -> peanuts::DeserializeResult<Self> { element.check_name("priority")?; element.check_namespace(XMLNS)?; @@ -272,7 +269,7 @@ impl FromElement for Priority { } impl IntoElement for Priority { - fn builder(&self) -> peanuts::element::ElementBuilder { + fn builder(&self) -> peanuts::ElementBuilder { Element::builder("priority", Some(XMLNS)).push_text(self.0) } } |