Skip to main content

CallBatcher

Struct CallBatcher 

Source
pub struct CallBatcher { /* private fields */ }

Implementations§

Source§

impl CallBatcher

Source

pub fn new() -> Self

Source

pub fn enqueue(&mut self, tool: impl Into<String>, args: Value) -> usize

Add a call to the queue. Returns its id.

Source

pub fn enqueue_with_priority( &mut self, tool: impl Into<String>, args: Value, priority: i32, ) -> usize

Source

pub fn flush(&mut self) -> Vec<PendingCall>

Remove and return all queued calls (in enqueue order).

Source

pub fn flush_by_priority(&mut self) -> Vec<PendingCall>

Remove and return calls sorted by priority descending.

Source

pub fn peek(&self) -> &[PendingCall]

Peek at calls without removing them.

Source

pub fn cancel(&mut self, id: usize) -> bool

Remove a specific call by id.

Source

pub fn calls_for(&self, tool: &str) -> Vec<&PendingCall>

Calls for a specific tool (peeked, not removed).

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn clear(&mut self)

Source

pub fn to_tool_use_blocks(&self) -> Vec<Value>

Build Anthropic-style tool_use content blocks.

Trait Implementations§

Source§

impl Debug for CallBatcher

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CallBatcher

Source§

fn default() -> CallBatcher

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.