Skip to main content

State

Type Alias State 

Source
pub type State = HashMap<String, Value>;
Expand description

Graph 共享状态。

Aliased Type§

pub struct State { /* private fields */ }

Trait Implementations§

Source§

impl StateExt for State

Source§

fn get_str(&self, key: &str) -> Option<&str>

Source§

fn get_bool(&self, key: &str) -> Option<bool>

Source§

fn get_u64(&self, key: &str) -> Option<u64>

Source§

fn get_i64(&self, key: &str) -> Option<i64>

Source§

fn get_f64(&self, key: &str) -> Option<f64>

Source§

fn get_json<T>(&self, key: &str) -> Result<T, StateError>

Source§

fn require<T>(&self, key: &str) -> Result<T, StateError>

Source§

fn set<T>(&mut self, key: impl Into<String>, value: T)
where T: Serialize,

Source§

fn remove(&mut self, key: &str) -> Option<Value>

Source§

fn contains(&self, key: &str) -> bool

Source§

fn reduce( &mut self, key: &str, value: Value, reducer: &StateReducer, ) -> Result<(), String>

Source§

fn append_array(&mut self, key: &str, items: Value) -> Result<(), String>

Source§

impl StateKeyExt for State

Source§

fn set_sk<T>(&mut self, key: &StateKey<T>, value: T)
where T: Serialize,

Source§

fn get_sk<T>(&self, key: &StateKey<T>) -> Option<T>

Source§

fn require_sk<T>(&self, key: &StateKey<T>) -> Result<T, StateError>

Source§

fn contains_sk<T>(&self, key: &StateKey<T>) -> bool

Source§

fn remove_sk<T>(&mut self, key: &StateKey<T>) -> Option<Value>