Skip to main content

WorkflowBuilder

Struct WorkflowBuilder 

Source
pub struct WorkflowBuilder { /* private fields */ }
Expand description

Fluent, validation-preserving workflow assembly.

Implementations§

Source§

impl WorkflowBuilder

Source

pub fn new(name: impl Into<String>) -> Self

Creates an empty version-one workflow definition.

Source

pub fn version(self, version: u32) -> Self

Sets the durable workflow definition version.

Source

pub fn timer(self, id: impl Into<String>, delay: Duration) -> Self

Appends a durable timer that releases its worker lease while waiting.

Source

pub fn wait_for_signal( self, id: impl Into<String>, signal: impl Into<String>, ) -> Self

Appends a durable external-signal wait targeted by checkpoint identity.

Source

pub fn wait_for_signal_or_timeout( self, id: impl Into<String>, signal: impl Into<String>, timeout: Duration, ) -> Self

Appends a durable race between an external signal and a timeout.

Source

pub fn interrupt(self, id: impl Into<String>, prompt: impl Into<String>) -> Self

Suspends until a human approves, edits, or rejects the current value.

The request and current proposal are checkpointed before the worker releases its lease. Reviewers can inspect the generated interrupt identity and submit an idempotent decision through crate::WorkflowStore.

Source

pub fn step<S>( self, id: impl Into<String>, step: S, capabilities: CapabilitySet, ) -> Self
where S: WorkflowStep + 'static,

Appends one custom executable step.

Source

pub fn agent( self, id: impl Into<String>, agent: Arc<Agent>, capabilities: CapabilitySet, ) -> Self

Appends one Agent-backed step.

Source

pub fn branch<C, T, F>( self, id: impl Into<String>, condition: C, when_true: T, when_false: F, capabilities: CapabilitySet, ) -> Self
where C: WorkflowCondition + 'static, T: WorkflowStep + 'static, F: WorkflowStep + 'static,

Appends a condition that executes exactly one of two steps.

Source

pub fn parallel( self, id: impl Into<String>, branches: impl IntoIterator<Item = ParallelBranch>, ) -> Self

Appends a deterministic fan-out/fan-in parallel node.

Every branch receives the same canonical input. Outputs are joined into an object keyed by branch identifier, independent of completion order.

Source

pub fn race( self, id: impl Into<String>, branches: impl IntoIterator<Item = ParallelBranch>, ) -> Self

Appends a budget-bounded, first-success race.

Race branches may request only Pure or ReadOnly capabilities. Losing reservations are conservatively forfeited because remote work may outlive local cancellation.

Source

pub fn build(self) -> Result<Workflow, WorkflowBuildError>

Validates and freezes this workflow definition.

§Errors

Returns WorkflowBuildError for invalid identity, version, duplicate steps, or an empty definition.

Trait Implementations§

Source§

impl Debug for WorkflowBuilder

Source§

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

Formats the value using the given formatter. 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.