disco: Use a reference everywhere, instead of taking ownership.
This commit is contained in:
parent
1190dd9001
commit
83cf57abd0
1 changed files with 10 additions and 10 deletions
20
src/disco.rs
20
src/disco.rs
|
|
@ -106,29 +106,29 @@ pub fn parse_disco(root: &Element) -> Result<Disco, Error> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn serialise_disco(disco: Disco) -> Element {
|
pub fn serialise_disco(disco: &Disco) -> Element {
|
||||||
let mut root = Element::builder("query")
|
let mut root = Element::builder("query")
|
||||||
.ns(DISCO_INFO_NS)
|
.ns(DISCO_INFO_NS)
|
||||||
.attr("node", disco.node)
|
.attr("node", disco.node.clone())
|
||||||
.build();
|
.build();
|
||||||
for identity in disco.identities {
|
for identity in &disco.identities {
|
||||||
let identity_element = Element::builder("identity")
|
let identity_element = Element::builder("identity")
|
||||||
.ns(DISCO_INFO_NS)
|
.ns(DISCO_INFO_NS)
|
||||||
.attr("category", identity.category)
|
.attr("category", identity.category.clone())
|
||||||
.attr("type", identity.type_)
|
.attr("type", identity.type_.clone())
|
||||||
.attr("xml:lang", identity.xml_lang)
|
.attr("xml:lang", identity.xml_lang.clone())
|
||||||
.attr("name", identity.name)
|
.attr("name", identity.name.clone())
|
||||||
.build();
|
.build();
|
||||||
root.append_child(identity_element);
|
root.append_child(identity_element);
|
||||||
}
|
}
|
||||||
for feature in disco.features {
|
for feature in &disco.features {
|
||||||
let feature_element = Element::builder("feature")
|
let feature_element = Element::builder("feature")
|
||||||
.ns(DISCO_INFO_NS)
|
.ns(DISCO_INFO_NS)
|
||||||
.attr("var", feature.var)
|
.attr("var", feature.var.clone())
|
||||||
.build();
|
.build();
|
||||||
root.append_child(feature_element);
|
root.append_child(feature_element);
|
||||||
}
|
}
|
||||||
for _ in disco.extensions {
|
for _ in &disco.extensions {
|
||||||
panic!("Not yet implemented!");
|
panic!("Not yet implemented!");
|
||||||
}
|
}
|
||||||
root
|
root
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue