pub struct Command<S: State> { /* private fields */ }Expand description
A command returned from a node to control graph flow.
Commands allow nodes to override normal edge-based routing, update state, fan out to multiple nodes, or signal interrupts.
§Example
ⓘ
use synaptic_graph::{Command, NodeOutput, MessageState};
async fn my_node(state: MessageState) -> Result<NodeOutput<MessageState>, SynapticError> {
Ok(NodeOutput::Command(Command::goto("summary")))
}Implementations§
Source§impl<S: State> Command<S>
impl<S: State> Command<S>
Sourcepub fn goto_with_update(node: impl Into<String>, update: S) -> Self
pub fn goto_with_update(node: impl Into<String>, update: S) -> Self
Create a command that routes to a specific node with a state update.
Sourcepub fn send(targets: Vec<Send>) -> Self
pub fn send(targets: Vec<Send>) -> Self
Create a command that fans out to multiple nodes (map-reduce).
Sourcepub fn update(state: S) -> Self
pub fn update(state: S) -> Self
Create a command that only updates state (no routing override).
Trait Implementations§
Auto Trait Implementations§
impl<S> Freeze for Command<S>where
S: Freeze,
impl<S> RefUnwindSafe for Command<S>where
S: RefUnwindSafe,
impl<S> Send for Command<S>
impl<S> Sync for Command<S>
impl<S> Unpin for Command<S>where
S: Unpin,
impl<S> UnsafeUnpin for Command<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for Command<S>where
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