pub struct SubFlow;Expand description
Creates durable SubFlow Conditions and reads their Execute results.
Construction encodes input and returns a Condition; Dex starts or attaches to the child when
the Worker submits that wait. The target Flow must be in the Worker’s Registry. The parent
waits durably without holding a handler thread. Inspect FlowResult for child failure;
a child’s abnormal terminal status is a result rather than a local value-mapping error.
Result indexes are zero-based within the SubFlow Conditions, not all Condition kinds.
use dex_sdk::{Flow, SdkResult, SubFlow, SubFlowOptions, Wait};
use std::time::Duration;
fn wait_for_child<F: Flow>(flow: &F, input: F::StartInput) -> SdkResult<Wait> {
let child = SubFlow::run_with_options(flow, input,
SubFlowOptions::new().timeout(Duration::from_secs(60)))?;
Ok(Wait::until(child))
}Implementations§
Source§impl SubFlow
impl SubFlow
Sourcepub fn run<SomeFlow: Flow>(
flow: &SomeFlow,
input: SomeFlow::StartInput,
) -> SdkResult<Condition>
pub fn run<SomeFlow: Flow>( flow: &SomeFlow, input: SomeFlow::StartInput, ) -> SdkResult<Condition>
Creates a SubFlow Condition with default options.
§Errors
Returns a value-mapping error when input cannot be encoded.
Sourcepub fn run_with_options<SomeFlow: Flow>(
flow: &SomeFlow,
input: SomeFlow::StartInput,
options: SubFlowOptions,
) -> SdkResult<Condition>
pub fn run_with_options<SomeFlow: Flow>( flow: &SomeFlow, input: SomeFlow::StartInput, options: SubFlowOptions, ) -> SdkResult<Condition>
Creates a SubFlow Condition with explicit options.
§Errors
Returns a value-mapping error when input cannot be encoded. Worker mapping later validates
the exact registered Rust Flow type, starting Step, Attributes, and option durations.
Sourcepub fn condition_result(context: &Context) -> HandlerResult<FlowResult>
pub fn condition_result(context: &Context) -> HandlerResult<FlowResult>
Returns the first SubFlow result during Step execute.
§Errors
Returns crate::HandlerError outside Execute or when the selected SubFlow result is
unavailable or malformed. See SubFlow for constructing the matching wait.
Sourcepub fn condition_result_at(
context: &Context,
index: usize,
) -> HandlerResult<FlowResult>
pub fn condition_result_at( context: &Context, index: usize, ) -> HandlerResult<FlowResult>
Returns one stable-indexed SubFlow result during Step execute.
§Errors
Returns crate::HandlerError outside Execute or when the selected SubFlow result is
unavailable or malformed. See SubFlow for constructing the matching wait.
Sourcepub fn flow_id(context: &Context) -> HandlerResult<String>
pub fn flow_id(context: &Context) -> HandlerResult<String>
Returns the generated Flow ID for the first SubFlow Condition during Step execute.
§Errors
Returns crate::HandlerError outside Execute or when the selected SubFlow result is
unavailable or malformed. See SubFlow for constructing the matching wait.
Sourcepub fn flow_id_at(context: &Context, index: usize) -> HandlerResult<String>
pub fn flow_id_at(context: &Context, index: usize) -> HandlerResult<String>
Returns the generated Flow ID for one stable-indexed SubFlow Condition during execute.
§Errors
Returns crate::HandlerError outside Execute or when the selected SubFlow result is
unavailable or malformed. See SubFlow for constructing the matching wait.
Auto Trait Implementations§
impl Forget for SubFlow
impl Freeze for SubFlow
impl RefUnwindSafe for SubFlow
impl Send for SubFlow
impl Sync for SubFlow
impl Unpin for SubFlow
impl UnsafeUnpin for SubFlow
impl UnwindSafe for SubFlow
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request