pub trait Step:
Send
+ Sync
+ 'static {
type Input: Value;
// Required method
fn execute(
&self,
context: &mut Context,
input: Self::Input,
) -> HandlerResult<StepDecision>;
// Provided methods
fn wait_for(
&self,
_context: &mut Context,
_input: Self::Input,
) -> HandlerResult<Wait> { ... }
fn step_type(&self) -> &'static str { ... }
fn options(&self) -> StepOptions<Self::Input> { ... }
}Expand description
Defines one durable state transition in a Flow.
Dex calls Self::wait_for to obtain durable conditions, then calls Self::execute after the
wait is satisfied. The default wait_for skips immediately, making execute-only Steps concise.
Handler code may read and stage persistence changes through Context.
§Examples
use dex_sdk::{Context, HandlerResult, Step, StepDecision};
struct CompleteOrder;
impl Step for CompleteOrder {
type Input = String;
fn execute(
&self,
_context: &mut Context,
order_id: Self::Input,
) -> HandlerResult<StepDecision> {
Ok(StepDecision::graceful_complete(order_id))
}
}Required Associated Types§
Required Methods§
Sourcefn execute(
&self,
context: &mut Context,
input: Self::Input,
) -> HandlerResult<StepDecision>
fn execute( &self, context: &mut Context, input: Self::Input, ) -> HandlerResult<StepDecision>
Produces the next movement or terminal Flow decision.
context represents one isolated invocation and input is a newly decoded owned value.
Returning HandlerError activates the configured execute retry and
failure behavior.
Provided Methods§
Sourcefn wait_for(
&self,
_context: &mut Context,
_input: Self::Input,
) -> HandlerResult<Wait>
fn wait_for( &self, _context: &mut Context, _input: Self::Input, ) -> HandlerResult<Wait>
Returns the durable conditions Dex must satisfy before execute.
The default returns Wait::skip_immediately. Returning an error activates the configured
wait_for retry and failure behavior.
Sourcefn step_type(&self) -> &'static str
fn step_type(&self) -> &'static str
Returns the stable Step type sent to Dex.
The default is the final Rust type-name segment.
Sourcefn options(&self) -> StepOptions<Self::Input>
fn options(&self) -> StepOptions<Self::Input>
Returns timeouts, retries, locks, durability, and failure behavior for this Step.
The default preserves server defaults and fails the Flow when wait_for exhausts retries.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".