pub struct ToolBatch { /* private fields */ }Expand description
One tool batch with a completed prefix and pending suffix.
Implementations§
Source§impl ToolBatch
impl ToolBatch
Sourcepub fn new(calls: Vec<ToolCallContext>) -> Result<Self, BatchError>
pub fn new(calls: Vec<ToolCallContext>) -> Result<Self, BatchError>
Creates a batch from declarations in their original order.
Sourcepub fn calls(&self) -> &[ToolCallEntry]
pub fn calls(&self) -> &[ToolCallEntry]
Returns the pending suffix.
Sourcepub fn calls_mut(&mut self) -> &mut [ToolCallEntry]
pub fn calls_mut(&mut self) -> &mut [ToolCallEntry]
Mutably returns the pending suffix.
Sourcepub fn results(&self) -> &[ToolCallEntry]
pub fn results(&self) -> &[ToolCallEntry]
Returns the completed prefix.
Sourcepub fn results_mut(&mut self) -> &mut [ToolCallEntry]
pub fn results_mut(&mut self) -> &mut [ToolCallEntry]
Mutably returns the completed prefix for output editing and ordering.
Sourcepub fn completed_len(&self) -> usize
pub fn completed_len(&self) -> usize
Returns the number of completed entries.
Sourcepub fn declaration_ids(&self) -> Vec<BlockId>
pub fn declaration_ids(&self) -> Vec<BlockId>
Returns declaration identities in the batch’s current entry order.
Sourcepub fn validate(&self) -> Result<(), BatchError>
pub fn validate(&self) -> Result<(), BatchError>
Validates the completed-prefix/pending-suffix and identity invariants.
Sourcepub fn resolve_at(
&mut self,
index: usize,
result_block_id: BlockId,
result: ToolResultPayload,
) -> Result<(), BatchError>
pub fn resolve_at( &mut self, index: usize, result_block_id: BlockId, result: ToolResultPayload, ) -> Result<(), BatchError>
Installs a result at an absolute entry index and advances the prefix. Validation failure leaves the batch unchanged.
Sourcepub fn into_results(
self,
) -> Result<Vec<(BlockId, ToolResultPayload)>, (BatchError, Self)>
pub fn into_results( self, ) -> Result<Vec<(BlockId, ToolResultPayload)>, (BatchError, Self)>
Consumes a fully completed batch into result blocks in current order.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ToolBatch
impl RefUnwindSafe for ToolBatch
impl Send for ToolBatch
impl Sync for ToolBatch
impl Unpin for ToolBatch
impl UnsafeUnpin for ToolBatch
impl UnwindSafe for ToolBatch
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