1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use super::*;
impl Table {
pub fn export_calculated_table(&self) -> Result<String, Box<dyn Error>> {
let mut writer = csv::Writer::from_writer(vec![]);
for line in &self.calculated_table {
let mut line_record = vec![];
for item in line {
line_record.push(format!("{}", item));
}
writer.write_record(line_record)?;
}
Ok(String::from_utf8(writer.into_inner()?)?)
}
pub fn export_raw_table(&self) -> Result<String, Box<dyn Error>> {
let mut writer = csv::Writer::from_writer(vec![]);
for line in &self.raw_table {
let mut line_record = vec![];
for item in line {
line_record.push(item);
}
writer.write_record(line_record)?;
}
Ok(String::from_utf8(writer.into_inner()?)?)
}
}