| 584 | } |
| 585 | |
| 586 | pub fn with_todo_update<F, Fut>(mut self, callback: F) -> Self |
| 587 | where |
| 588 | F: Fn(String, Vec<TodoItemData>) -> Fut + Send + Sync + 'static, |
| 589 | Fut: std::future::Future<Output = Result<(), ToolError>> + Send + 'static, |
| 590 | { |
| 591 | self.todo_update = Some(Arc::new(move |session_id, todos| { |
| 592 | Box::pin(callback(session_id, todos)) |
| 593 | })); |
| 594 | self |
| 595 | } |
| 596 | |
| 597 | pub async fn do_todo_update(&self, todos: Vec<TodoItemData>) -> Result<(), ToolError> { |
| 598 | if let Some(ref callback) = self.todo_update { |