Use String instead of bytes, change error handling

This commit is contained in:
sharkdp authored and David Peter committed 2018-03-20 21:40:06 +01:00
1 parent bd81fe65a2
commit 4b8cc34815
3 files changed
+18 -15

No files matched your search

+3 -3
View File
@@ -70,7 +70,7 @@ pub enum ExportType {
/// Interface for different exporters.
trait Exporter {
/// Export the given entries in the serialized form.
fn serialize(&self, values: &Vec<ExportEntry>) -> Result<Vec<u8>>;
fn serialize(&self, results: &Vec<ExportEntry>) -> Result<String>;
}
/// Handles the management of multiple file exporters.
@@ -107,8 +107,8 @@ impl ExportManager {
}
/// Write the given content to a file with the specified name
fn write_to_file(filename: &str, content: Vec<u8>) -> Result<()> {
fn write_to_file(filename: &str, content: String) -> Result<()> {
let mut file = File::create(filename)?;
file.write_all(&content)?;
file.write_all(content.as_bytes())?;
Ok(())
}