pub struct Workflow { /* private fields */ }Expand description
Builder for creating a WorkflowDef.
§Examples
use ironflow_engine::config::ShellConfig;
use ironflow_engine::workflow::Workflow;
let def = Workflow::new("deploy")
.shell("build", ShellConfig::new("cargo build"))
.build()
.expect("valid workflow");Implementations§
Source§impl Workflow
impl Workflow
Sourcepub fn new(name: &str) -> Self
pub fn new(name: &str) -> Self
Start building a new workflow with the given name.
§Examples
use ironflow_engine::workflow::Workflow;
let builder = Workflow::new("my-pipeline");Sourcepub fn shell(self, name: &str, config: ShellConfig) -> Self
pub fn shell(self, name: &str, config: ShellConfig) -> Self
Add a shell step.
§Examples
use ironflow_engine::config::ShellConfig;
use ironflow_engine::workflow::Workflow;
let builder = Workflow::new("ci")
.shell("test", ShellConfig::new("cargo test"));Sourcepub fn http(self, name: &str, config: HttpConfig) -> Self
pub fn http(self, name: &str, config: HttpConfig) -> Self
Add an HTTP step.
§Examples
use ironflow_engine::config::HttpConfig;
use ironflow_engine::workflow::Workflow;
let builder = Workflow::new("notify")
.http("webhook", HttpConfig::post("https://hooks.example.com/notify"));Sourcepub fn agent(self, name: &str, config: AgentStepConfig) -> Self
pub fn agent(self, name: &str, config: AgentStepConfig) -> Self
Add an agent step.
§Examples
use ironflow_engine::config::AgentStepConfig;
use ironflow_engine::workflow::Workflow;
let builder = Workflow::new("review")
.agent("review-code", AgentStepConfig::new("Review this PR"));Sourcepub fn workflow(self, name: &str, config: WorkflowStepConfig) -> Self
pub fn workflow(self, name: &str, config: WorkflowStepConfig) -> Self
Add a sub-workflow step.
§Examples
use ironflow_engine::config::WorkflowStepConfig;
use ironflow_engine::workflow::Workflow;
use ironflow_engine::config::ShellConfig;
use serde_json::json;
let builder = Workflow::new("pipeline")
.shell("lint", ShellConfig::new("cargo clippy"))
.workflow("run-tests", WorkflowStepConfig::new("ci-test", json!({})));Sourcepub fn step(self, name: &str, config: StepConfig) -> Self
pub fn step(self, name: &str, config: StepConfig) -> Self
Add a step with an arbitrary StepConfig.
Use this when you have a pre-built StepConfig or need to add
steps programmatically.
Sourcepub fn build(self) -> Result<WorkflowDef, EngineError>
pub fn build(self) -> Result<WorkflowDef, EngineError>
Consume the builder and produce an immutable WorkflowDef.
§Errors
Returns EngineError::StepConfig if the name is empty/whitespace
or no steps were added.
§Examples
use ironflow_engine::config::ShellConfig;
use ironflow_engine::workflow::Workflow;
let def = Workflow::new("ci")
.shell("test", ShellConfig::new("cargo test"))
.build()
.expect("valid workflow");
assert_eq!(def.steps.len(), 1);Auto Trait Implementations§
impl Freeze for Workflow
impl RefUnwindSafe for Workflow
impl Send for Workflow
impl Sync for Workflow
impl Unpin for Workflow
impl UnsafeUnpin for Workflow
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