Save the data to the list file when updated
This commit is contained in:
parent
c72b3d1669
commit
9be9808463
|
@ -22,6 +22,12 @@ impl List {
|
|||
|
||||
pub fn update_data(&mut self, data : &String) {
|
||||
self.data = data.clone();
|
||||
let mut file = File::create(&self.path)
|
||||
.expect(&format!("Cannot open list file {}",
|
||||
self.path.to_str().unwrap()));
|
||||
file.write_all(data.as_bytes())
|
||||
.expect(&format!("Cannot write list file {}",
|
||||
self.path.to_str().unwrap()));
|
||||
}
|
||||
|
||||
pub fn load_all() -> Vec<Self> {
|
||||
|
|
Loading…
Reference in New Issue