From d824a161b65c2064e9eddfd22de1ba6e057fd9a0 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sat, 29 Apr 2017 03:50:20 +0100 Subject: [PATCH] message: Implement IntoElements. --- src/message.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/message.rs b/src/message.rs index 609aa77..34dc49b 100644 --- a/src/message.rs +++ b/src/message.rs @@ -1,7 +1,7 @@ use std::str::FromStr; -use minidom::Element; -use minidom::IntoAttributeValue; +use minidom::{Element, IntoElements, IntoAttributeValue}; +use minidom::convert::ElementEmitter; use jid::Jid; @@ -164,6 +164,13 @@ pub fn serialise(message: &Message) -> Element { stanza } +impl IntoElements for Message { + fn into_elements(self, emitter: &mut ElementEmitter) { + let elem = serialise(&self); + emitter.append_child(elem); + } +} + #[cfg(test)] mod tests { use std::str::FromStr;