pub struct GraphBuilder { /* private fields */ }Expand description
Builds a Graph.
Implementations§
Source§impl GraphBuilder
impl GraphBuilder
Sourcepub fn edge_if(
self,
from: impl Into<String>,
to: impl Into<String>,
condition: impl Fn(&GraphState) -> bool + WasmCompatSend + WasmCompatSync + 'static,
) -> Self
pub fn edge_if( self, from: impl Into<String>, to: impl Into<String>, condition: impl Fn(&GraphState) -> bool + WasmCompatSend + WasmCompatSync + 'static, ) -> Self
Run to after from when condition holds on the run so far.
let graph = Graph::builder()
.node("review", review)
.node("publish", publish)
.edge_if("review", "publish", |state: &GraphState| {
state.output("review").is_some_and(|verdict| verdict.contains("APPROVED"))
})
.build()?;Sourcepub fn entry(self, id: impl Into<String>) -> Self
pub fn entry(self, id: impl Into<String>) -> Self
Start the run with this node (call it again for several). Defaults to every node without incoming edges.
Sourcepub fn max_node_executions(self, max: usize) -> Self
pub fn max_node_executions(self, max: usize) -> Self
How many node runs, in all, a graph run may make. Required when the graph has a cycle; unbounded otherwise.
Sourcepub fn execution_timeout(self, timeout: Duration) -> Self
pub fn execution_timeout(self, timeout: Duration) -> Self
How long a whole run may take. Defaults to 15 minutes.
Sourcepub fn node_timeout(self, timeout: Duration) -> Self
pub fn node_timeout(self, timeout: Duration) -> Self
How long one node may take. Defaults to 5 minutes.
Sourcepub fn checkpoints(
self,
store: impl AsyncStore + WasmCompatSend + WasmCompatSync + 'static,
) -> Self
pub fn checkpoints( self, store: impl AsyncStore + WasmCompatSend + WasmCompatSync + 'static, ) -> Self
Sourcepub fn build(self) -> Result<Graph, BuildError>
pub fn build(self) -> Result<Graph, BuildError>
Check the nodes and edges.
Auto Trait Implementations§
impl !RefUnwindSafe for GraphBuilder
impl !UnwindSafe for GraphBuilder
impl Forget for GraphBuilder
impl Freeze for GraphBuilder
impl Move for GraphBuilder
impl Send for GraphBuilder
impl Sync for GraphBuilder
impl Unpin for GraphBuilder
impl UnsafeUnpin for GraphBuilder
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