(save_file: &str, todos: &Vec<TodoItem>)
| 26 | } |
| 27 | |
| 28 | pub fn save_todo_list(save_file: &str, todos: &Vec<TodoItem>) -> Result<(), String> { |
| 29 | let data = serde_json::to_string(todos).map_err(|e| e.to_string())?; |
| 30 | fs::write(save_file, data).map_err(|e| e.to_string())?; |
| 31 | |
| 32 | Ok(()) |
| 33 | } |