aidens_tool_kit/
custom.rs1use serde_json::Value;
8use std::sync::Arc;
9
10#[async_trait::async_trait]
12pub trait CustomToolExecutor: Send + Sync + std::fmt::Debug {
13 async fn execute(&self, tool_id: &str, input: Value) -> anyhow::Result<String>;
15
16 fn clone_box(&self) -> Arc<dyn CustomToolExecutor>;
18}
19
20#[derive(Clone)]
22pub struct CustomExecutorHandle {
23 pub inner: Arc<dyn CustomToolExecutor>,
24}
25
26impl std::fmt::Debug for CustomExecutorHandle {
27 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
28 f.debug_struct("CustomExecutorHandle").finish()
29 }
30}
31
32impl CustomExecutorHandle {
33 pub fn new(exec: Arc<dyn CustomToolExecutor>) -> Self {
34 Self { inner: exec }
35 }
36}