Loads a TodoListState with the given id
(os: &Os, id: &str)
| 58 | |
| 59 | /// Loads a TodoListState with the given id |
| 60 | pub async fn load(os: &Os, id: &str) -> Result<Self> { |
| 61 | let state_str = os |
| 62 | .fs |
| 63 | .read_to_string(id_to_path(os, id)?) |
| 64 | .await |
| 65 | .map_err(|e| eyre!("Could not load todo list: {e}"))?; |
| 66 | serde_json::from_str::<Self>(&state_str).map_err(|e| eyre!("Could not deserialize todo list: {e}")) |
| 67 | } |
| 68 | |
| 69 | /// Saves this TodoListState with the given id |
| 70 | pub async fn save(&self, os: &Os, id: &str) -> Result<()> { |
no test coverage detected