Skip to main content

WorkflowInfo

Struct WorkflowInfo 

Source
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: String

Human-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 dataetl. 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

Source

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());
Source

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;"));
Source

pub fn with_sub_workflows<I, S>(self, names: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

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()]);
Source

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"));
Source

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"));
Source

pub fn with_compatible_versions<I, S>(self, versions: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

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()]);
Source

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");
Source

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");
Source

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());
Source

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

Source§

fn clone(&self) -> WorkflowInfo

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for WorkflowInfo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for WorkflowInfo

Source§

fn default() -> WorkflowInfo

Returns the “default value” for a type. Read more
Source§

impl Serialize for WorkflowInfo

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more