aboutsummaryrefslogtreecommitdiffstats
path: root/src/parser.rs
diff options
context:
space:
mode:
authorPhilipp A2018-11-20 10:53:34 +0100
committerPhilipp A2018-11-20 10:53:34 +0100
commit32d660c23ca7d44da44112187f2efb18fa4077ed (patch)
treec2cd2dd0c1493a16727f97744044ad239da0365f /src/parser.rs
parentbb184822fc281e9fbfcd706a091be2e9d3ac38f4 (diff)
downloadrust-rst-32d660c23ca7d44da44112187f2efb18fa4077ed.tar.bz2
added silly xml serializing
Diffstat (limited to 'src/parser.rs')
-rw-r--r--src/parser.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/parser.rs b/src/parser.rs
index 69ead45..a75d2a1 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -125,9 +125,14 @@ pub fn parse(source: &str) -> Result<Document, Error> {
}
-/// only until we can serialize DocumentTrees
pub fn serialize_json<W>(source: &str, stream: W) -> Result<(), Error> where W: Write {
let parsed = parse(source)?;
serde_json::to_writer(stream, &parsed)?;
Ok(())
}
+
+pub fn serialize_xml<W>(source: &str, stream: W) -> Result<(), Error> where W: Write {
+ let parsed = parse(source)?;
+ serde_xml_rs::serialize(&parsed, stream)?;
+ Ok(())
+}