From 83cf57abd05da4bf4b3ea9f2edb0453ba91087c7 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Thu, 20 Apr 2017 21:53:46 +0100 Subject: [PATCH] disco: Use a reference everywhere, instead of taking ownership. --- src/disco.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/disco.rs b/src/disco.rs index 2a4ff64..4b2d033 100644 --- a/src/disco.rs +++ b/src/disco.rs @@ -106,29 +106,29 @@ pub fn parse_disco(root: &Element) -> Result { }); } -pub fn serialise_disco(disco: Disco) -> Element { +pub fn serialise_disco(disco: &Disco) -> Element { let mut root = Element::builder("query") .ns(DISCO_INFO_NS) - .attr("node", disco.node) + .attr("node", disco.node.clone()) .build(); - for identity in disco.identities { + for identity in &disco.identities { let identity_element = Element::builder("identity") .ns(DISCO_INFO_NS) - .attr("category", identity.category) - .attr("type", identity.type_) - .attr("xml:lang", identity.xml_lang) - .attr("name", identity.name) + .attr("category", identity.category.clone()) + .attr("type", identity.type_.clone()) + .attr("xml:lang", identity.xml_lang.clone()) + .attr("name", identity.name.clone()) .build(); root.append_child(identity_element); } - for feature in disco.features { + for feature in &disco.features { let feature_element = Element::builder("feature") .ns(DISCO_INFO_NS) - .attr("var", feature.var) + .attr("var", feature.var.clone()) .build(); root.append_child(feature_element); } - for _ in disco.extensions { + for _ in &disco.extensions { panic!("Not yet implemented!"); } root