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) -> Result<JsonState, AgentError>
pub fn from_value(value: Value) -> Result<JsonState, AgentError>
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<JsonState, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<JsonState, <__D as Deserializer<'de>>::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 = Result<(), AgentError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
JsonState: 'async_trait,
fn apply_update<'life0, 'life1, 'async_trait>(
&'life0 mut self,
key: &'life1 str,
value: Value,
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
JsonState: 'async_trait,
Apply a state update Read more
Source§fn apply_updates<'life0, 'life1, 'async_trait>(
&'life0 mut self,
updates: &'life1 [StateUpdate],
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn apply_updates<'life0, 'life1, 'async_trait>(
&'life0 mut self,
updates: &'life1 [StateUpdate],
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Apply multiple updates
Source§impl Serialize for JsonState
impl Serialize for JsonState
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Message for T
impl<T> Message for T
Source§fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
Convert a BoxedMessage to this concrete type
Source§fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
Convert this message to a BoxedMessage