pub struct WorkflowBuilder { /* private fields */ }Expand description
Builder for constructing workflow DAGs.
Add nodes with node, wire them with edge
or conditional, then call build.
Implementations§
Source§impl WorkflowBuilder
impl WorkflowBuilder
Sourcepub fn node<F, Fut>(self, name: impl Into<String>, handler: F) -> Self
pub fn node<F, Fut>(self, name: impl Into<String>, handler: F) -> Self
Add a node to the workflow.
The handler receives a WorkflowContext and returns Result<Value>.
Nodes with no incoming edges are considered entry points and run first.
Sourcepub fn edge(self, from: impl Into<String>, to: impl Into<String>) -> Self
pub fn edge(self, from: impl Into<String>, to: impl Into<String>) -> Self
Add a direct edge from one node to another.
The to node will only execute after from completes successfully.
Multiple edges into the same node create a join (all predecessors must
complete).
Sourcepub fn conditional<F>(self, from: impl Into<String>, evaluator: F) -> Self
pub fn conditional<F>(self, from: impl Into<String>, evaluator: F) -> Self
Add a conditional edge from a node.
After from completes, evaluator is called with the node’s result
value. It returns a list of downstream node names to activate. Nodes
not in the returned list are skipped (treated as completed with a
null result).
Auto Trait Implementations§
impl Freeze for WorkflowBuilder
impl !RefUnwindSafe for WorkflowBuilder
impl Send for WorkflowBuilder
impl Sync for WorkflowBuilder
impl Unpin for WorkflowBuilder
impl UnsafeUnpin for WorkflowBuilder
impl !UnwindSafe for WorkflowBuilder
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