Merge branch 'minidom' into 'master'

lumi created

Implement IntoElements on Jid

See merge request lumi/jid-rs!9

Change summary

Cargo.toml | 2 +-
src/lib.rs | 9 ++++++++-
2 files changed, 9 insertions(+), 2 deletions(-)

Detailed changes

Cargo.toml 🔗

@@ -1,6 +1,6 @@
 [package]
 name = "jid"
-version = "0.3.0"
+version = "0.3.1"
 authors = ["lumi <lumi@pew.im>", "Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>"]
 description = "A crate which provides a Jid struct for Jabber IDs."
 homepage = "https://gitlab.com/lumi/jid-rs"

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::*;