pub struct ToolCallBuffer {
pub id: String,
pub name: Option<String>,
pub args_json: String,
}Expand description
Buffer for accumulating tool call arguments during streaming
Uses pre-allocated capacity to minimize allocations during streaming. The default capacity of 256 bytes handles most small tool arguments without reallocation.
Fields§
§id: String§name: Option<String>§args_json: StringImplementations§
Source§impl ToolCallBuffer
impl ToolCallBuffer
Sourcepub fn with_capacity(id: String, capacity: usize) -> Self
pub fn with_capacity(id: String, capacity: usize) -> Self
Create a new buffer with custom capacity for large arguments
Sourcepub fn try_complete(&self) -> Option<ToolCall>
pub fn try_complete(&self) -> Option<ToolCall>
Try to complete the tool call (parse JSON args)
Trait Implementations§
Source§impl Clone for ToolCallBuffer
impl Clone for ToolCallBuffer
Source§fn clone(&self) -> ToolCallBuffer
fn clone(&self) -> ToolCallBuffer
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ToolCallBuffer
impl Debug for ToolCallBuffer
Source§impl Default for ToolCallBuffer
impl Default for ToolCallBuffer
Source§fn default() -> ToolCallBuffer
fn default() -> ToolCallBuffer
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ToolCallBuffer
impl RefUnwindSafe for ToolCallBuffer
impl Send for ToolCallBuffer
impl Sync for ToolCallBuffer
impl Unpin for ToolCallBuffer
impl UnsafeUnpin for ToolCallBuffer
impl UnwindSafe for ToolCallBuffer
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