(mut self, callback: F)
| 548 | } |
| 549 | |
| 550 | pub fn with_update_message<F, Fut>(mut self, callback: F) -> Self |
| 551 | where |
| 552 | F: Fn(serde_json::Value) -> Fut + Send + Sync + 'static, |
| 553 | Fut: std::future::Future<Output = Result<(), ToolError>> + Send + 'static, |
| 554 | { |
| 555 | self.update_message = Some(Arc::new(move |msg| Box::pin(callback(msg)))); |
| 556 | self |
| 557 | } |
| 558 | |
| 559 | pub async fn do_update_message(&self, msg: serde_json::Value) -> Result<(), ToolError> { |
| 560 | if let Some(ref callback) = self.update_message { |