aboutsummaryrefslogblamecommitdiffstats
path: root/stanza/src/xep_0199.rs
blob: 9605721913a5cfe0abb87dc4de2f4c01407389fb (plain) (tree)

























                                                                                             
use peanuts::{
    element::{FromElement, IntoElement},
    Element,
};

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::element::DeserializeResult<Self> {
        element.check_name("ping")?;
        element.check_namespace(XMLNS)?;

        element.no_more_content()?;

        Ok(Ping)
    }
}

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