Skip to main content

ScratchpadStore

Trait ScratchpadStore 

Source
pub trait ScratchpadStore: Send + Sync {
    // Required methods
    fn set(&self, key: &str, value: String);
    fn get(&self, key: &str) -> Option<String>;
    fn entries(&self) -> BTreeMap<String, String>;
    fn clear(&self);
    fn keys_count(&self) -> u64;
    fn state_chars(&self) -> u64;
}
Expand description

A session store for the scratchpad <state> (Step 26.4). &self methods (interior mutability) so a single shared &dyn ScratchpadStore serves both the per-turn injection and the tool-mutation path.

Required Methods§

Source

fn set(&self, key: &str, value: String)

Set (or overwrite) one key.

Source

fn get(&self, key: &str) -> Option<String>

Read one key’s full (un-truncated) value.

Source

fn entries(&self) -> BTreeMap<String, String>

A sorted snapshot of all entries (for the <state> block).

Source

fn clear(&self)

Drop all entries (/new, or the model’s state_clear).

Source

fn keys_count(&self) -> u64

Number of keys held (for /context stats).

Source

fn state_chars(&self) -> u64

Total chars across all values (for /context stats).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§