optionally implement minidom::IntoElements

Emmanuel Gil Peyrot created

Change summary

src/lib.rs | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

Detailed changes

src/lib.rs 🔗

@@ -363,7 +363,7 @@ impl Jid {
 extern crate minidom;
 
 #[cfg(feature = "minidom")]
-use minidom::IntoAttributeValue;
+use minidom::{IntoAttributeValue, IntoElements, ElementEmitter};
 
 #[cfg(feature = "minidom")]
 impl IntoAttributeValue for Jid {
@@ -372,6 +372,13 @@ impl IntoAttributeValue for Jid {
     }
 }
 
+#[cfg(feature = "minidom")]
+impl IntoElements for Jid {
+    fn into_elements(self, emitter: &mut ElementEmitter) {
+        emitter.append_text_node(String::from(self))
+    }
+}
+
 #[cfg(test)]
 mod tests {
     use super::*;