aboutsummaryrefslogtreecommitdiffstats
path: root/src/renderer.rs
blob: 82a58269722cec8be63aa2faf178920471b2c35e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
mod html;
#[cfg(test)]
pub mod html_tests;


use std::io::Write;

use failure::Error;

use crate::document_tree::Document;


pub fn render_json<W>(document: &Document, stream: W) -> Result<(), Error> where W: Write {
	serde_json::to_writer(stream, &document)?;
	Ok(())
}

pub fn render_xml<W>(document: &Document, stream: W) -> Result<(), Error> where W: Write {
	serde_xml_rs::to_writer(stream, &document).map_err(failure::SyncFailure::new)?;
	Ok(())
}

pub use html::render_html;