Skip to main content

WorkflowDefinition

Trait WorkflowDefinition 

Source
pub trait WorkflowDefinition: Send + Sync {
    // Required methods
    fn spec(&self) -> &WorkflowSpec;
    fn perform<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        ctx: &'life1 WriteCtx,
        call: &'life2 Call<'life3>,
    ) -> Pin<Box<dyn Future<Output = ServiceResult<Value>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;

    // Provided method
    fn function<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        ctx: &'life1 WriteCtx,
        name: &'life2 str,
        args: &'life3 [Value],
    ) -> Pin<Box<dyn Future<Output = ServiceResult<Value>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait { ... }
}
Expand description

A workflow the engine can run: its spec, and what only typed code performs.

Required Methods§

Source

fn spec(&self) -> &WorkflowSpec

The compiled workflow.

Source

fn perform<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, ctx: &'life1 WriteCtx, call: &'life2 Call<'life3>, ) -> Pin<Box<dyn Future<Output = ServiceResult<Value>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Perform an action the engine does not: an entity action through the entity’s generated service, a transition, or a hand-written verb. The answer is the step’s result. An error of a kind a caller can fix (NotFound, Validation, Violations, AlreadyExists) is a business failure and is not retried; any other is transient and is.

Provided Methods§

Source

fn function<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, ctx: &'life1 WriteCtx, name: &'life2 str, args: &'life3 [Value], ) -> Pin<Box<dyn Future<Output = ServiceResult<Value>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Call a function the workflow declares under functions:.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§