pub struct InMemory { /* private fields */ }Expand description
In-memory store backed by Arc<Mutex<Vec<(String, String)>>>.
Clone is cheap — clones share the same underlying storage.
Implementations§
Source§impl InMemory
impl InMemory
Sourcepub fn with_entries(entries: impl IntoIterator<Item = (String, String)>) -> Self
pub fn with_entries(entries: impl IntoIterator<Item = (String, String)>) -> Self
Create a store pre-populated with entries.
Trait Implementations§
Source§impl Memory for InMemory
impl Memory for InMemory
Source§fn set(
&self,
key: impl Into<String>,
value: impl Into<String>,
) -> Option<String>
fn set( &self, key: impl Into<String>, value: impl Into<String>, ) -> Option<String>
Set (upsert) a key-value pair. Returns the previous value if the key existed.
Source§fn remove(&self, key: &str) -> Option<String>
fn remove(&self, key: &str) -> Option<String>
Remove a key. Returns the removed value if it existed.
Source§fn compile(&self) -> String
fn compile(&self) -> String
Compile memory into a string for system prompt injection. Read more
Source§fn store(
&self,
key: impl Into<String> + Send,
value: impl Into<String> + Send,
) -> impl Future<Output = Result<(), Error>> + Send
fn store( &self, key: impl Into<String> + Send, value: impl Into<String> + Send, ) -> impl Future<Output = Result<(), Error>> + Send
Store a key-value pair (async). Default delegates to
set.Auto Trait Implementations§
impl Freeze for InMemory
impl RefUnwindSafe for InMemory
impl Send for InMemory
impl Sync for InMemory
impl Unpin for InMemory
impl UnsafeUnpin for InMemory
impl UnwindSafe for InMemory
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<M> Hook for M
impl<M> Hook for M
Source§fn on_build_agent(&self, config: AgentConfig) -> AgentConfig
fn on_build_agent(&self, config: AgentConfig) -> AgentConfig
Source§fn on_register_tools(
&self,
registry: &mut ToolRegistry,
) -> impl Future<Output = ()> + Send
fn on_register_tools( &self, registry: &mut ToolRegistry, ) -> impl Future<Output = ()> + Send
Called by
Runtime::new() to register tool schemas into the registry. Read more