Skip to main content

State

Trait State 

Source
pub trait State: Send + Sync {
    // Required methods
    fn get(&self, key: &str) -> Result<Value, SessionError>;
    fn set(&self, key: &str, value: Value) -> Result<(), SessionError>;
    fn all(&self) -> Vec<(String, Value)>;
}
Expand description

A key-value store of JSON values: read, write and list the state of a session.

Required Methods§

Source

fn get(&self, key: &str) -> Result<Value, SessionError>

The value for key; SessionError::StateKeyNotExist if absent.

Source

fn set(&self, key: &str, value: Value) -> Result<(), SessionError>

Sets key to value, overwriting any existing value.

Source

fn all(&self) -> Vec<(String, Value)>

A snapshot of all key-value pairs; order is not guaranteed.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§