From 20949c283290d8ce2ed98982a7b418761f07408d Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sun, 23 Apr 2017 18:36:12 +0100 Subject: [PATCH] hashes: Implement serialise. --- src/hashes.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/hashes.rs b/src/hashes.rs index f9e1e846..febf8b3f 100644 --- a/src/hashes.rs +++ b/src/hashes.rs @@ -28,6 +28,14 @@ pub fn parse_hash(root: &Element) -> Result { }) } +pub fn serialise(hash: &Hash) -> Element { + Element::builder("hash") + .ns(ns::HASHES) + .attr("algo", hash.algo.clone()) + .append(hash.hash.clone()) + .build() +} + #[cfg(test)] mod tests { use minidom::Element;