aboutsummaryrefslogtreecommitdiffstats
path: root/stanza/src/xep_0199.rs
blob: 2ab3a86d1438323f992a1a623274e7d5e35f4220 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use peanuts::{Element, FromElement, IntoElement};

pub const XMLNS: &str = "urn:xmpp:ping";

#[derive(Clone, Copy, Debug)]
pub struct Ping;

impl FromElement for Ping {
    fn from_element(element: peanuts::Element) -> peanuts::DeserializeResult<Self> {
        element.check_name("ping")?;
        element.check_namespace(XMLNS)?;

        element.no_more_content()?;

        Ok(Ping)
    }
}

impl IntoElement for Ping {
    fn builder(&self) -> peanuts::ElementBuilder {
        Element::builder("ping", Some(XMLNS))
    }
}