(&self, session_id: &str, index: usize)
| 148 | } |
| 149 | |
| 150 | pub async fn remove(&self, session_id: &str, index: usize) -> bool { |
| 151 | let mut state = self.state.write().await; |
| 152 | if let Some(todos) = state.get_mut(session_id) { |
| 153 | if index < todos.len() { |
| 154 | todos.remove(index); |
| 155 | |
| 156 | if let Some(ref db) = self.db { |
| 157 | let todo_id = format!("{}_{}", session_id, index); |
| 158 | let _ = db.delete(session_id, &todo_id).await; |
| 159 | } |
| 160 | |
| 161 | return true; |
| 162 | } |
| 163 | } |
| 164 | false |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | impl Default for TodoManager { |
no test coverage detected