Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Workflow

The workflow module provides a TOML-based DSL for defining pipeline stages and transitions.

WorkflowToml

#![allow(unused)]
fn main() {
pub struct WorkflowToml {
    pub version: String,
    pub state: Vec<StateDef>,
    pub transitions: Vec<TransitionDef>,
}
}

StateDef

#![allow(unused)]
fn main() {
pub struct StateDef {
    pub id: String,
    pub description: String,
    pub verbs: Vec<VerbDef>,
}
}

TransitionDef

#![allow(unused)]
fn main() {
pub struct TransitionDef {
    pub from: String,
    pub to: String,
    pub event: String,
    pub guard: Option<String>,
}
}

Compilation

The workflow DSL compiles to:

  • Mermaid: Visual diagram generation
  • Rhai: Runtime execution FSM
  • Rust enum: Compile-time type safety

Example

[workflow]
version = "1.0"

[[state]]
id = "Ingested"
description = "Document parsed"

[[state]]
id = "Validating"
description = "Checking integrity"

[[transition]]
from = "Ingested"
to = "Validating"
event = "validate"