Reimplement JsonHeaderParser::write()

This commit is contained in:
Matthias Beyer 2015-12-02 11:52:36 +01:00
parent df18071d9a
commit 34cf5076f9

View file

@ -45,9 +45,16 @@ impl FileHeaderParser for JsonHeaderParser {
} }
fn write(&self, data: &FileHeaderData) -> Result<String, ParserError> { fn write(&self, data: &FileHeaderData) -> Result<String, ParserError> {
let mut ser = Serializer::pretty(stdout()); let mut s = Vec::<u8>::new();
data.serialize(&mut ser); {
Ok(String::from("")) let mut ser = Serializer::pretty(&mut s);
data.serialize(&mut ser);
}
String::from_utf8(s).or(
Err(ParserError::short("Cannot parse utf8 bytes",
String::from("<not printable>"),
0)))
} }
} }