pub enum ToolFunction {
Sync(Box<dyn Fn(Value) -> Result<String> + Send + Sync>),
Async(Box<dyn Fn(Value) -> BoxFuture<'static, Result<String>> + Send + Sync>),
}Expand description
Wrapper for tool functions (sync or async)
Tool functions receive raw JSON args and are responsible for deserializing
into their expected type. The tool<T, F>() method handles this automatically
by wrapping typed handlers.
Variants§
Sync(Box<dyn Fn(Value) -> Result<String> + Send + Sync>)
Async(Box<dyn Fn(Value) -> BoxFuture<'static, Result<String>> + Send + Sync>)
Auto Trait Implementations§
impl !RefUnwindSafe for ToolFunction
impl !UnwindSafe for ToolFunction
impl Freeze for ToolFunction
impl Send for ToolFunction
impl Sync for ToolFunction
impl Unpin for ToolFunction
impl UnsafeUnpin for ToolFunction
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more