pub struct StateSchema {
pub channels: HashMap<String, Channel>,
}Available on crate feature
graph only.Expand description
State schema defines channels and their reducers
Fields§
§channels: HashMap<String, Channel>Channel definitions
Implementations§
Source§impl StateSchema
impl StateSchema
Sourcepub fn new() -> StateSchema
pub fn new() -> StateSchema
Create a new empty schema
Sourcepub fn builder() -> StateSchemaBuilder
pub fn builder() -> StateSchemaBuilder
Create a schema builder
Sourcepub fn simple(channels: &[&str]) -> StateSchema
pub fn simple(channels: &[&str]) -> StateSchema
Create a simple schema with just channel names (all overwrite)
Sourcepub fn get_reducer(&self, channel: &str) -> &Reducer
pub fn get_reducer(&self, channel: &str) -> &Reducer
Get the reducer for a channel
Sourcepub fn get_default(&self, channel: &str) -> Option<&Value>
pub fn get_default(&self, channel: &str) -> Option<&Value>
Get the default value for a channel
Sourcepub fn apply_update(
&self,
state: &mut HashMap<String, Value>,
key: &str,
value: Value,
)
pub fn apply_update( &self, state: &mut HashMap<String, Value>, key: &str, value: Value, )
Apply an update to state using the appropriate reducer
Sourcepub fn initialize_state(&self) -> HashMap<String, Value>
pub fn initialize_state(&self) -> HashMap<String, Value>
Initialize state with default values
Trait Implementations§
Source§impl Clone for StateSchema
impl Clone for StateSchema
Source§fn clone(&self) -> StateSchema
fn clone(&self) -> StateSchema
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for StateSchema
impl Default for StateSchema
Source§fn default() -> StateSchema
fn default() -> StateSchema
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for StateSchema
impl !RefUnwindSafe for StateSchema
impl Send for StateSchema
impl Sync for StateSchema
impl Unpin for StateSchema
impl !UnwindSafe for StateSchema
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request