Skip to main content

WorkflowRunExt

Trait WorkflowRunExt 

Source
pub trait WorkflowRunExt<C, Input, M> {
    // Required method
    fn run_once(
        &self,
        input: Input,
    ) -> impl Future<Output = Result<WorkflowStatus, RuntimeError>> + Send + '_
       where Input: Send + 'static,
             M: Send + Sync + 'static,
             C: Codec + EnvelopeCodec + EncodeValue<Input>;
}
Expand description

Extension trait providing convenience methods on Workflow.

§Caveats

This trait uses InProcessRunner under the hood, which means:

  • No checkpointing — workflow state is not persisted between steps.
  • No crash recovery — if the process dies, progress is lost.
  • No distributed execution — everything runs in the current process.

For production use with durability guarantees, use a WorkflowRunner backed by a persistence backend (e.g. PostgreSQL) instead.

Required Methods§

Source

fn run_once( &self, input: Input, ) -> impl Future<Output = Result<WorkflowStatus, RuntimeError>> + Send + '_
where Input: Send + 'static, M: Send + Sync + 'static, C: Codec + EnvelopeCodec + EncodeValue<Input>,

Run the workflow once in-process without persistence.

Uses InProcessRunner internally — no backend, no instance ID. Ideal for quick testing and simple scripts.

§Example
let ctx = WorkflowContext::new("demo", std::sync::Arc::new(JsonCodec), std::sync::Arc::new(()));
let workflow = WorkflowBuilder::new(ctx)
    .then("greet", |name: String| async move { Ok(format!("Hello, {name}!")) })
    .build()?;

let status = workflow.run_once("World".to_string()).await?;

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<C, Input, M> WorkflowRunExt<C, Input, M> for Workflow<C, Input, M>