pub struct SharedState { /* private fields */ }Expand description
A shared string key-value store for sub-agent communication.
Cheaply cloneable (wraps Arc). Delegates all operations to a
pluggable SharedStateBackend.
Implementations§
Sourcepub fn with_max_bytes(max_bytes: usize) -> Self
pub fn with_max_bytes(max_bytes: usize) -> Self
Create a new in-memory store with a custom byte capacity.
Sourcepub fn with_backend(backend: impl SharedStateBackend + 'static) -> Self
pub fn with_backend(backend: impl SharedStateBackend + 'static) -> Self
Create a store backed by a custom backend.
Sourcepub async fn get(&self, key: &str) -> Option<String>
pub async fn get(&self, key: &str) -> Option<String>
Get a value by key. Returns None if the key doesn’t exist.
Trait Implementations§
Source§fn clone(&self) -> SharedState
fn clone(&self) -> SharedState
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
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