pub struct StateUpdate<S: StateSchema> {
pub update: Option<S>,
pub metadata: HashMap<String, Value>,
}Expand description
State update representation
Nodes return StateUpdate which contains partial updates to the state. The reducer pattern determines how updates are merged into the full state.
Fields§
§update: Option<S>Full or partial state update
metadata: HashMap<String, Value>Additional metadata (for debugging/tracing)
Implementations§
Source§impl<S: StateSchema> StateUpdate<S>
impl<S: StateSchema> StateUpdate<S>
Sourcepub fn with_metadata(state: S, metadata: HashMap<String, Value>) -> Self
pub fn with_metadata(state: S, metadata: HashMap<String, Value>) -> Self
Create update with metadata
Sourcepub fn add_metadata(&mut self, key: String, value: Value)
pub fn add_metadata(&mut self, key: String, value: Value)
Add metadata entry
Trait Implementations§
Source§impl<S: Clone + StateSchema> Clone for StateUpdate<S>
impl<S: Clone + StateSchema> Clone for StateUpdate<S>
Source§fn clone(&self) -> StateUpdate<S>
fn clone(&self) -> StateUpdate<S>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<S: Debug + StateSchema> Debug for StateUpdate<S>
impl<S: Debug + StateSchema> Debug for StateUpdate<S>
Source§impl<S> Serialize for StateUpdate<S>where
S: Serialize + StateSchema,
impl<S> Serialize for StateUpdate<S>where
S: Serialize + StateSchema,
Auto Trait Implementations§
impl<S> Freeze for StateUpdate<S>
impl<S> RefUnwindSafe for StateUpdate<S>where
Option<S>: RefUnwindSafe,
impl<S> Send for StateUpdate<S>
impl<S> Sync for StateUpdate<S>
impl<S> Unpin for StateUpdate<S>
impl<S> UnsafeUnpin for StateUpdate<S>where
Option<S>: UnsafeUnpin,
impl<S> UnwindSafe for StateUpdate<S>where
Option<S>: UnwindSafe,
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