From 835b66e70812db023dcb9c66cf4027f573ceaaac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20R=C3=B6nnb=C3=A4ck?= Date: Thu, 5 Feb 2026 11:13:41 +0100 Subject: [PATCH] Step 5: Page 30 --- src/main.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main.rs b/src/main.rs index 3809671..ccbbe24 100644 --- a/src/main.rs +++ b/src/main.rs @@ -49,6 +49,12 @@ impl TodoList { Ok(TodoList::new()) } } + + fn save_to_file(&self, filename: &str) -> Result<(), Box> { + let json = serde_json::to_string_pretty(self)?; + fs::write(filename, json)?; + Ok(()) + } } fn main() { let cli = Cli::parse();