Skip to main content

State

Trait State 

Source
pub trait State:
    Send
    + Sync
    + Clone
    + Serialize
    + DeserializeOwned
    + 'static {
    // Required methods
    fn to_value(&self) -> Result<Value, Box<dyn Error + Send + Sync>>;
    fn from_value(value: Value) -> Result<Self, Box<dyn Error + Send + Sync>>;
}
Expand description

State trait for agent state.

Agents maintain state that can be serialized and deserialized.

Required Methods§

Source

fn to_value(&self) -> Result<Value, Box<dyn Error + Send + Sync>>

Serialize state to JSON value.

Source

fn from_value(value: Value) -> Result<Self, Box<dyn Error + Send + Sync>>

Deserialize state from JSON value.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§