(mut self, callback: F)
| 364 | } |
| 365 | |
| 366 | pub fn with_ask<F, Fut>(mut self, callback: F) -> Self |
| 367 | where |
| 368 | F: Fn(PermissionRequest) -> Fut + Send + Sync + 'static, |
| 369 | Fut: std::future::Future<Output = Result<(), ToolError>> + Send + 'static, |
| 370 | { |
| 371 | self.ask = Some(Arc::new(move |req| Box::pin(callback(req)))); |
| 372 | self |
| 373 | } |
| 374 | |
| 375 | pub async fn ask_permission(&self, request: PermissionRequest) -> Result<(), ToolError> { |
| 376 | if let Some(ref callback) = self.ask { |