pub struct NodeOutput {
pub updates: HashMap<String, Value>,
pub command: Option<Command>,
}Expand description
The output of a node: partial state updates plus optional dynamic routing.
Fields§
§updates: HashMap<String, Value>Partial updates to merge into shared state at the barrier, keyed by
channel name. Merge semantics come from the channel’s
crate::state::Reducer. Nodes must not return whole state.
command: Option<Command>Optional dynamic routing decision (overrides static edges).
Some(Command::default()) is a no-op in disguise (see
Command::is_noop); prefer None for “no override”.
Implementations§
Source§impl NodeOutput
impl NodeOutput
Sourcepub fn update(channel: impl Into<String>, value: Value) -> Self
pub fn update(channel: impl Into<String>, value: Value) -> Self
An output carrying a single channel update.
Sourcepub fn updates(updates: HashMap<String, Value>) -> Self
pub fn updates(updates: HashMap<String, Value>) -> Self
An output carrying multiple channel updates.
Sourcepub fn from_updates(updates: HashMap<String, Value>) -> Self
pub fn from_updates(updates: HashMap<String, Value>) -> Self
Alias for NodeOutput::updates that reads better next to
NodeOutput::update / NodeOutput::with_update.
Sourcepub fn route(command: Command) -> Self
pub fn route(command: Command) -> Self
An output that only routes (no state updates).
Note that Command::default is a no-op (Command::is_noop);
wrapping one in Some here is accepted but has no effect.
Sourcepub fn with_command(self, command: Command) -> Self
pub fn with_command(self, command: Command) -> Self
Builder-style: attach a routing command.
Sourcepub fn with_update(self, channel: impl Into<String>, value: Value) -> Self
pub fn with_update(self, channel: impl Into<String>, value: Value) -> Self
Builder-style: add one channel update.