pub struct WorkflowInfo {
pub description: String,
pub source_code: Option<String>,
pub sub_workflows: Vec<String>,
pub category: Option<String>,
pub version: Option<String>,
pub compatible_versions: Vec<String>,
pub input_schema: Option<Value>,
pub default_labels: HashMap<String, String>,
pub schedule: Option<CronSchedule>,
pub default_max_cost_usd: Option<Decimal>,
}Expand description
Metadata about a workflow, returned by WorkflowHandler::describe.
Contains a human-readable description and optional Rust source code for display in the dashboard.
Most handlers never build this struct by hand: override
WorkflowHandler::description and WorkflowHandler::source_code and
the default WorkflowHandler::describe assembles it from the other
trait methods. The builder below exists for handlers that override
describe entirely.
§Examples
use ironflow_engine::handler::WorkflowInfo;
let info = WorkflowInfo::new("Deploy to production")
.with_category("ops")
.with_version("2.0.0")
.with_sub_workflows(["build"]);
assert_eq!(info.description, "Deploy to production");
assert_eq!(info.category.as_deref(), Some("ops"));
assert_eq!(info.sub_workflows, vec!["build".to_string()]);Fields§
§description: StringHuman-readable description of what the workflow does.
source_code: Option<String>Optional Rust source code of the handler (for UI display).
sub_workflows: Vec<String>Names of sub-workflows invoked by this handler.
category: Option<String>Optional /-separated category path used to group workflows in the UI tree.
A value like "data/etl" places the workflow under data → etl.
None means the workflow is uncategorized.
version: Option<String>Handler version string, used to trace which code produced a given run.
compatible_versions: Vec<String>Versions accepted for replay without force.
input_schema: Option<Value>JSON Schema describing the expected input payload.
When present, the dashboard renders a dynamic form from this schema and the engine validates the payload before creating a run.
default_labels: HashMap<String, String>Labels automatically applied to every run of this workflow.
schedule: Option<CronSchedule>Optional cron schedule for automatic execution.
default_max_cost_usd: Option<Decimal>Default cumulative cost cap applied to runs of this workflow, in USD.
Overridden by a cap supplied at run creation, and takes precedence over
the server-wide default. None means the handler declares no default.
Implementations§
Source§impl WorkflowInfo
impl WorkflowInfo
Sourcepub fn new(description: impl Into<String>) -> Self
pub fn new(description: impl Into<String>) -> Self
Create metadata with a description and every other field at its default.
§Examples
use ironflow_engine::handler::WorkflowInfo;
let info = WorkflowInfo::new("Nightly backup");
assert_eq!(info.description, "Nightly backup");
assert!(info.source_code.is_none());
assert!(info.sub_workflows.is_empty());Sourcepub fn with_source_code(self, source: impl Into<String>) -> Self
pub fn with_source_code(self, source: impl Into<String>) -> Self
Attach the handler source code, typically via include_str!.
§Examples
use ironflow_engine::handler::WorkflowInfo;
let info = WorkflowInfo::new("Demo").with_source_code("struct Demo;");
assert_eq!(info.source_code.as_deref(), Some("struct Demo;"));Sourcepub fn with_sub_workflows<I, S>(self, names: I) -> Self
pub fn with_sub_workflows<I, S>(self, names: I) -> Self
Declare the sub-workflows this handler invokes.
§Examples
use ironflow_engine::handler::WorkflowInfo;
let info = WorkflowInfo::new("Report").with_sub_workflows(["collect", "enrich"]);
assert_eq!(info.sub_workflows, vec!["collect".to_string(), "enrich".to_string()]);Sourcepub fn with_category(self, category: impl Into<String>) -> Self
pub fn with_category(self, category: impl Into<String>) -> Self
Set the /-separated category path.
§Examples
use ironflow_engine::handler::WorkflowInfo;
let info = WorkflowInfo::new("ETL").with_category("data/etl");
assert_eq!(info.category.as_deref(), Some("data/etl"));Sourcepub fn with_version(self, version: impl Into<String>) -> Self
pub fn with_version(self, version: impl Into<String>) -> Self
Set the handler version.
§Examples
use ironflow_engine::handler::WorkflowInfo;
let info = WorkflowInfo::new("Deploy").with_version("1.2.0");
assert_eq!(info.version.as_deref(), Some("1.2.0"));Sourcepub fn with_compatible_versions<I, S>(self, versions: I) -> Self
pub fn with_compatible_versions<I, S>(self, versions: I) -> Self
Set the versions accepted for replay without force.
§Examples
use ironflow_engine::handler::WorkflowInfo;
let info = WorkflowInfo::new("Deploy").with_compatible_versions(["1.0.0"]);
assert_eq!(info.compatible_versions, vec!["1.0.0".to_string()]);Sourcepub fn with_input_schema(self, schema: Value) -> Self
pub fn with_input_schema(self, schema: Value) -> Self
Set the JSON Schema of the expected input payload.
§Examples
use ironflow_engine::handler::WorkflowInfo;
use serde_json::json;
let info = WorkflowInfo::new("Greet").with_input_schema(json!({"type": "object"}));
assert_eq!(info.input_schema.unwrap()["type"], "object");Sourcepub fn with_default_labels(self, labels: HashMap<String, String>) -> Self
pub fn with_default_labels(self, labels: HashMap<String, String>) -> Self
Set the labels applied to every run of this workflow.
§Examples
use std::collections::HashMap;
use ironflow_engine::handler::WorkflowInfo;
let labels = HashMap::from([("team".to_string(), "core".to_string())]);
let info = WorkflowInfo::new("Sync").with_default_labels(labels);
assert_eq!(info.default_labels["team"], "core");Sourcepub fn with_schedule(self, schedule: CronSchedule) -> Self
pub fn with_schedule(self, schedule: CronSchedule) -> Self
Set the cron schedule.
§Examples
use ironflow_engine::handler::WorkflowInfo;
use ironflow_engine::schedule::CronSchedule;
let schedule = CronSchedule::new("0 0 * * *")?;
let info = WorkflowInfo::new("Nightly").with_schedule(schedule);
assert!(info.schedule.is_some());Sourcepub fn with_default_max_cost_usd(self, cap: Decimal) -> Self
pub fn with_default_max_cost_usd(self, cap: Decimal) -> Self
Set the default cumulative cost cap in USD.
§Examples
use ironflow_engine::handler::WorkflowInfo;
use rust_decimal::Decimal;
let info = WorkflowInfo::new("Analysis").with_default_max_cost_usd(Decimal::new(500, 2));
assert_eq!(info.default_max_cost_usd, Some(Decimal::new(500, 2)));Trait Implementations§
Source§impl Clone for WorkflowInfo
impl Clone for WorkflowInfo
Source§fn clone(&self) -> WorkflowInfo
fn clone(&self) -> WorkflowInfo
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more