pub struct StateBucket {
pub shared_state: Value,
pub history: VecDeque<ToolCallRecord>,
/* private fields */
}Expand description
Mutable state shared across tool calls with the same state_key.
Fields§
§history: VecDeque<ToolCallRecord>Implementations§
Source§impl StateBucket
impl StateBucket
Sourcepub fn with_capacity(history_cap: usize) -> Self
pub fn with_capacity(history_cap: usize) -> Self
A cap of 0 is promoted to 1.
Sourcepub fn record(&mut self, record: ToolCallRecord)
pub fn record(&mut self, record: ToolCallRecord)
Record a call, evicting the oldest if we exceed the cap.
pub const fn history_cap(&self) -> usize
Trait Implementations§
Source§impl Clone for StateBucket
impl Clone for StateBucket
Source§fn clone(&self) -> StateBucket
fn clone(&self) -> StateBucket
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 moreAuto Trait Implementations§
impl Freeze for StateBucket
impl RefUnwindSafe for StateBucket
impl Send for StateBucket
impl Sync for StateBucket
impl Unpin for StateBucket
impl UnsafeUnpin for StateBucket
impl UnwindSafe for StateBucket
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