Skip to main content

ToolFn

Trait ToolFn 

Source
pub trait ToolFn:
    for<'a> Fn(HashMap<String, Value>, &'a ToolContext<'a>) -> MaybeSendBoxFuture<'a, ToolResult>
    + MaybeSend
    + MaybeSync { }
Expand description

Trait combining the necessary bounds for a tool function.

This is a workaround for Rust compiler error E0225, which prevents using non-auto traits like MaybeSend in a dyn trait object with Fn. Users typically don’t need to implement this directly; any closure matching the signature automatically implements it.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T> ToolFn for T
where T: for<'a> Fn(HashMap<String, Value>, &'a ToolContext<'a>) -> MaybeSendBoxFuture<'a, ToolResult> + MaybeSend + MaybeSync + 'static,