From ca6e65ad761746813b3087c7b7d8613a9c1d94ea Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sun, 23 Apr 2017 02:24:13 +0100 Subject: [PATCH] body: Add a serialise function. --- src/body.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/body.rs b/src/body.rs index dcc4389d..f170cd38 100644 --- a/src/body.rs +++ b/src/body.rs @@ -17,6 +17,13 @@ pub fn parse_body(root: &Element) -> Result { Ok(root.text()) } +pub fn serialise(body: &Body) -> Element { + Element::builder("body") + .ns(ns::JABBER_CLIENT) + .append(body.to_owned()) + .build() +} + #[cfg(test)] mod tests { use minidom::Element;