Reimplement JsonHeaderParser::write()
This commit is contained in:
parent
df18071d9a
commit
34cf5076f9
1 changed files with 10 additions and 3 deletions
|
@ -45,9 +45,16 @@ impl FileHeaderParser for JsonHeaderParser {
|
|||
}
|
||||
|
||||
fn write(&self, data: &FileHeaderData) -> Result<String, ParserError> {
|
||||
let mut ser = Serializer::pretty(stdout());
|
||||
data.serialize(&mut ser);
|
||||
Ok(String::from(""))
|
||||
let mut s = Vec::<u8>::new();
|
||||
{
|
||||
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)))
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue