pub struct Workflow {
pub name: String,
pub start: String,
pub max_steps: u32,
pub max_retries: u32,
pub state: BTreeMap<String, Value>,
pub nodes: Vec<Node>,
pub edges: Vec<Edge>,
}Expand description
A validated workflow: name, start node, step and retry caps, the compiled JSON Schema of every state key, nodes and edges. Plain data, so a graph run keeps a snapshot of the workflow it started with.
Fields§
§name: String§start: String§max_steps: u32§max_retries: u32§state: BTreeMap<String, Value>§nodes: Vec<Node>§edges: Vec<Edge>Implementations§
Source§impl Workflow
impl Workflow
Sourcepub fn parse(file: &str, text: &str) -> Result<Workflow, WorkflowError>
pub fn parse(file: &str, text: &str) -> Result<Workflow, WorkflowError>
Parses and validates workflow TOML text read from file: fields,
node kinds, state keys, edges, reachability, router-free cycles and
fan-out joins. Returns the first problem found.
Sourcepub fn node(&self, id: &str) -> Option<&Node>
pub fn node(&self, id: &str) -> Option<&Node>
Returns the node with id id.
None when the workflow has none.
Ids are unique, so at most one matches.
Sourcepub fn next(&self, id: &str) -> Vec<&Edge>
pub fn next(&self, id: &str) -> Vec<&Edge>
Returns the out-edges of node id in file order.
Fan-out branches and router choices follow this order.
Empty for end nodes and unknown ids.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Workflow
impl<'de> Deserialize<'de> for Workflow
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Workflow
Auto Trait Implementations§
impl Forget for Workflow
impl Freeze for Workflowwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
*const LeafNode<String, Value> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, Value)>>: Freeze,
PhantomData<Node>: Freeze,
PhantomData<Edge>: Freeze,
impl Move for Workflow
impl RefUnwindSafe for Workflow
impl Send for Workflow
impl Sync for Workflow
impl Unpin for Workflow
impl UnsafeUnpin for Workflowwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const LeafNode<String, Value> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, Value)>>: UnsafeUnpin,
PhantomData<Node>: UnsafeUnpin,
PhantomData<Edge>: UnsafeUnpin,
impl UnwindSafe for Workflow
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