1use serde::{Serialize, Deserialize};
2use std::io::Write;
3
4#[derive(Debug, Serialize, Deserialize)]
5pub struct Array{
6 pub values: Vec<String>
7}
8
9impl Array{
10 pub fn walk(&self, name: &str, mut file: &std::fs::File, depth: u64){
11 let t = (0..depth).map(|_| "\t").collect::<String>();
12 let t2 = (0..=depth).map(|_| "\t").collect::<String>();
13 file.write_all(format!("{}{}[]={{\r\n",t, name).as_bytes()).unwrap();
14
15 for v in &self.values {
16 file.write_all(format!("{}{},\r\n",t2, v).as_bytes()).unwrap();
17 }
18 file.write_all(format!("{}}};\r\n", t).as_bytes()).unwrap();
19 }
20}