pub struct ToolBundle { /* private fields */ }Expand description
A collection of Tool implementations dispatched by name.
Implementations§
Source§impl ToolBundle
impl ToolBundle
pub fn new() -> Self
Sourcepub fn with<T: Tool + 'static>(self, tool: T) -> Self
pub fn with<T: Tool + 'static>(self, tool: T) -> Self
Add a tool to this bundle, returning self for chaining.
Sourcepub fn push_boxed(&mut self, tool: Box<dyn Tool>)
pub fn push_boxed(&mut self, tool: Box<dyn Tool>)
Add an already-boxed tool in-place.
Sourcepub fn remove_by_names(&mut self, names: &[String])
pub fn remove_by_names(&mut self, names: &[String])
Remove all tools whose raw_tools() contains any of the given names.
Trait Implementations§
Source§impl<T: Tool + 'static> Add<T> for ToolBundle
impl<T: Tool + 'static> Add<T> for ToolBundle
Source§impl<T: Tool + 'static> AddAssign<T> for ToolBundle
impl<T: Tool + 'static> AddAssign<T> for ToolBundle
Source§fn add_assign(&mut self, rhs: T)
fn add_assign(&mut self, rhs: T)
Performs the
+= operation. Read moreSource§impl Default for ToolBundle
impl Default for ToolBundle
Source§impl<T: Tool + 'static> Sub<T> for ToolBundle
impl<T: Tool + 'static> Sub<T> for ToolBundle
Source§impl<T: Tool + 'static> SubAssign<T> for ToolBundle
impl<T: Tool + 'static> SubAssign<T> for ToolBundle
Source§fn sub_assign(&mut self, rhs: T)
fn sub_assign(&mut self, rhs: T)
Performs the
-= operation. Read moreSource§impl<T: Tool + 'static> Sum<T> for ToolBundle
impl<T: Tool + 'static> Sum<T> for ToolBundle
Source§impl Tool for ToolBundle
impl Tool for ToolBundle
Source§fn raw_tools(&self) -> Vec<RawTool>
fn raw_tools(&self) -> Vec<RawTool>
Return the list of raw tool definitions to send to the API.
Source§fn call<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
args: Value,
) -> Pin<Box<dyn Future<Output = BoxStream<'static, ToolOutput>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn call<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
args: Value,
) -> Pin<Box<dyn Future<Output = BoxStream<'static, ToolOutput>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Invoke the named tool with the given arguments and return a stream of outputs.
Auto Trait Implementations§
impl Freeze for ToolBundle
impl !RefUnwindSafe for ToolBundle
impl Send for ToolBundle
impl Sync for ToolBundle
impl Unpin for ToolBundle
impl UnsafeUnpin for ToolBundle
impl !UnwindSafe for ToolBundle
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