From ba4fd6d8e9ca18cc18e75d48ab8a3a0bebc7b4e4 Mon Sep 17 00:00:00 2001 From: cel 🌸 Date: Fri, 30 May 2025 14:01:24 +0100 Subject: chore(stanza): update peanuts and use workspace deps --- stanza/src/bind.rs | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'stanza/src/bind.rs') diff --git a/stanza/src/bind.rs b/stanza/src/bind.rs index f72c510..3ce2246 100644 --- a/stanza/src/bind.rs +++ b/stanza/src/bind.rs @@ -1,8 +1,5 @@ use jid::JID; -use peanuts::{ - element::{FromElement, IntoElement}, - Element, -}; +use peanuts::{Element, FromElement, IntoElement}; pub const XMLNS: &str = "urn:ietf:params:xml:ns:xmpp-bind"; @@ -12,7 +9,7 @@ pub struct Bind { } impl FromElement for Bind { - fn from_element(mut element: peanuts::Element) -> peanuts::element::DeserializeResult { + fn from_element(mut element: peanuts::Element) -> peanuts::DeserializeResult { element.check_name("bind")?; element.check_namespace(XMLNS)?; @@ -23,7 +20,7 @@ impl FromElement for Bind { } impl IntoElement for Bind { - fn builder(&self) -> peanuts::element::ElementBuilder { + fn builder(&self) -> peanuts::ElementBuilder { Element::builder("bind", Some(XMLNS)).push_child_opt(self.r#type.clone()) } } @@ -35,7 +32,7 @@ pub enum BindType { } impl FromElement for BindType { - fn from_element(element: peanuts::Element) -> peanuts::element::DeserializeResult { + fn from_element(element: peanuts::Element) -> peanuts::DeserializeResult { match element.identify() { (Some(XMLNS), "resource") => { Ok(BindType::Resource(ResourceType::from_element(element)?)) @@ -47,7 +44,7 @@ impl FromElement for BindType { } impl IntoElement for BindType { - fn builder(&self) -> peanuts::element::ElementBuilder { + fn builder(&self) -> peanuts::ElementBuilder { match self { BindType::Resource(resource_type) => resource_type.builder(), BindType::Jid(full_jid_type) => full_jid_type.builder(), @@ -60,7 +57,7 @@ impl IntoElement for BindType { pub struct FullJidType(pub JID); impl FromElement for FullJidType { - fn from_element(mut element: peanuts::Element) -> peanuts::element::DeserializeResult { + fn from_element(mut element: peanuts::Element) -> peanuts::DeserializeResult { element.check_name("jid")?; element.check_namespace(XMLNS)?; @@ -71,7 +68,7 @@ impl FromElement for FullJidType { } impl IntoElement for FullJidType { - fn builder(&self) -> peanuts::element::ElementBuilder { + fn builder(&self) -> peanuts::ElementBuilder { Element::builder("jid", Some(XMLNS)).push_text(self.0.clone()) } } @@ -81,7 +78,7 @@ impl IntoElement for FullJidType { pub struct ResourceType(pub String); impl FromElement for ResourceType { - fn from_element(mut element: peanuts::Element) -> peanuts::element::DeserializeResult { + fn from_element(mut element: peanuts::Element) -> peanuts::DeserializeResult { element.check_name("resource")?; element.check_namespace(XMLNS)?; @@ -92,7 +89,7 @@ impl FromElement for ResourceType { } impl IntoElement for ResourceType { - fn builder(&self) -> peanuts::element::ElementBuilder { + fn builder(&self) -> peanuts::ElementBuilder { Element::builder("resource", Some(XMLNS)).push_text(self.0.clone()) } } -- cgit