pub struct JsonState { /* private fields */ }Expand description
A simple JSON-based state implementation
This is a basic implementation of GraphState that uses a JSON object as the backing store. Useful for simple workflows or testing.
Implementations§
Source§impl JsonState
impl JsonState
Sourcepub fn from_value(value: Value) -> AgentResult<Self>
pub fn from_value(value: Value) -> AgentResult<Self>
Create from a JSON value (must be an object)
Sourcepub fn as_map_mut(&mut self) -> &mut Map<String, Value>
pub fn as_map_mut(&mut self) -> &mut Map<String, Value>
Get a mutable reference to the underlying map
Trait Implementations§
Source§impl<'de> Deserialize<'de> for JsonState
impl<'de> Deserialize<'de> for JsonState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl GraphState for JsonState
impl GraphState for JsonState
Source§fn apply_update<'life0, 'life1, 'async_trait>(
&'life0 mut self,
key: &'life1 str,
value: Value,
) -> Pin<Box<dyn Future<Output = AgentResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn apply_update<'life0, 'life1, 'async_trait>(
&'life0 mut self,
key: &'life1 str,
value: Value,
) -> Pin<Box<dyn Future<Output = AgentResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Apply a state update Read more
Source§fn to_json(&self) -> AgentResult<Value>
fn to_json(&self) -> AgentResult<Value>
Convert entire state to a JSON Value
Source§fn from_json(value: Value) -> AgentResult<Self>
fn from_json(value: Value) -> AgentResult<Self>
Create state from a JSON Value
Source§fn apply_updates<'life0, 'life1, 'async_trait>(
&'life0 mut self,
updates: &'life1 [StateUpdate],
) -> Pin<Box<dyn Future<Output = AgentResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn apply_updates<'life0, 'life1, 'async_trait>(
&'life0 mut self,
updates: &'life1 [StateUpdate],
) -> Pin<Box<dyn Future<Output = AgentResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Apply multiple updates
Auto Trait Implementations§
impl Freeze for JsonState
impl RefUnwindSafe for JsonState
impl Send for JsonState
impl Sync for JsonState
impl Unpin for JsonState
impl UnsafeUnpin for JsonState
impl UnwindSafe for JsonState
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