aboutsummaryrefslogtreecommitdiffstats
path: root/stanza/src/xep_0059.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stanza/src/xep_0059.rs41
1 files changed, 21 insertions, 20 deletions
diff --git a/stanza/src/xep_0059.rs b/stanza/src/xep_0059.rs
index 01dbc6c..84f84ff 100644
--- a/stanza/src/xep_0059.rs
+++ b/stanza/src/xep_0059.rs
@@ -1,7 +1,8 @@
-use peanuts::{
- element::{FromElement, IntoElement},
- Element,
-};
+// SPDX-FileCopyrightText: 2025 cel <cel@bunny.garden>
+//
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+use peanuts::{Element, FromElement, IntoElement};
pub const XMLNS: &str = "http://jabber.org/protocol/rsm";
@@ -17,7 +18,7 @@ pub struct Set {
}
impl FromElement for Set {
- fn from_element(mut element: Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(mut element: Element) -> peanuts::DeserializeResult<Self> {
element.check_name("set")?;
element.check_namespace(XMLNS)?;
@@ -42,7 +43,7 @@ impl FromElement for Set {
}
impl IntoElement for Set {
- fn builder(&self) -> peanuts::element::ElementBuilder {
+ fn builder(&self) -> peanuts::ElementBuilder {
Element::builder("set", Some(XMLNS))
.push_child_opt(self.after.clone())
.push_child_opt(self.before.clone())
@@ -58,7 +59,7 @@ impl IntoElement for Set {
pub struct After(pub String);
impl FromElement for After {
- fn from_element(mut element: Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(mut element: Element) -> peanuts::DeserializeResult<Self> {
element.check_name("after")?;
element.check_namespace(XMLNS)?;
@@ -67,7 +68,7 @@ impl FromElement for After {
}
impl IntoElement for After {
- fn builder(&self) -> peanuts::element::ElementBuilder {
+ fn builder(&self) -> peanuts::ElementBuilder {
// TODO: better way for push_text to work, empty string should be empty element no matter what
let builder = Element::builder("after", Some(XMLNS));
@@ -83,7 +84,7 @@ impl IntoElement for After {
pub struct Before(pub String);
impl FromElement for Before {
- fn from_element(mut element: Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(mut element: Element) -> peanuts::DeserializeResult<Self> {
element.check_name("before")?;
element.check_namespace(XMLNS)?;
@@ -92,7 +93,7 @@ impl FromElement for Before {
}
impl IntoElement for Before {
- fn builder(&self) -> peanuts::element::ElementBuilder {
+ fn builder(&self) -> peanuts::ElementBuilder {
// TODO: better way for push_text to work, empty string should be empty element no matter what
let builder = Element::builder("before", Some(XMLNS));
@@ -108,7 +109,7 @@ impl IntoElement for Before {
pub struct Count(pub i32);
impl FromElement for Count {
- fn from_element(mut element: Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(mut element: Element) -> peanuts::DeserializeResult<Self> {
element.check_name("count")?;
element.check_namespace(XMLNS)?;
@@ -117,7 +118,7 @@ impl FromElement for Count {
}
impl IntoElement for Count {
- fn builder(&self) -> peanuts::element::ElementBuilder {
+ fn builder(&self) -> peanuts::ElementBuilder {
Element::builder("count", Some(XMLNS)).push_text(self.0)
}
}
@@ -126,7 +127,7 @@ impl IntoElement for Count {
pub struct Index(pub i32);
impl FromElement for Index {
- fn from_element(mut element: Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(mut element: Element) -> peanuts::DeserializeResult<Self> {
element.check_name("index")?;
element.check_namespace(XMLNS)?;
@@ -135,7 +136,7 @@ impl FromElement for Index {
}
impl IntoElement for Index {
- fn builder(&self) -> peanuts::element::ElementBuilder {
+ fn builder(&self) -> peanuts::ElementBuilder {
Element::builder("index", Some(XMLNS)).push_text(self.0)
}
}
@@ -144,7 +145,7 @@ impl IntoElement for Index {
pub struct Last(pub String);
impl FromElement for Last {
- fn from_element(mut element: Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(mut element: Element) -> peanuts::DeserializeResult<Self> {
element.check_name("last")?;
element.check_namespace(XMLNS)?;
@@ -153,7 +154,7 @@ impl FromElement for Last {
}
impl IntoElement for Last {
- fn builder(&self) -> peanuts::element::ElementBuilder {
+ fn builder(&self) -> peanuts::ElementBuilder {
// TODO: better way for push_text to work, empty string should be empty element no matter what
let builder = Element::builder("last", Some(XMLNS));
@@ -169,7 +170,7 @@ impl IntoElement for Last {
pub struct Max(pub i32);
impl FromElement for Max {
- fn from_element(mut element: Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(mut element: Element) -> peanuts::DeserializeResult<Self> {
element.check_name("max")?;
element.check_namespace(XMLNS)?;
@@ -178,7 +179,7 @@ impl FromElement for Max {
}
impl IntoElement for Max {
- fn builder(&self) -> peanuts::element::ElementBuilder {
+ fn builder(&self) -> peanuts::ElementBuilder {
Element::builder("max", Some(XMLNS)).push_text(self.0)
}
}
@@ -190,7 +191,7 @@ pub struct First {
}
impl FromElement for First {
- fn from_element(mut element: peanuts::Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(mut element: peanuts::Element) -> peanuts::DeserializeResult<Self> {
element.check_name("first")?;
element.check_namespace(XMLNS)?;
@@ -203,7 +204,7 @@ impl FromElement for First {
}
impl IntoElement for First {
- fn builder(&self) -> peanuts::element::ElementBuilder {
+ fn builder(&self) -> peanuts::ElementBuilder {
let builder =
Element::builder("first", Some(XMLNS)).push_attribute_opt("index", self.index);