pub struct ConditionalScopeConfigurator<'pipeline, TData: 'static + Send + Sync, SData: 'static + Send + Sync, Err: Error + From<OrkaError> + Send + Sync + 'static, P: PipelineProvider<TData, SData, Err> + 'static> { /* private fields */ }Expand description
Intermediate builder to configure a single conditional scope.
TData: Main pipeline’s underlying context data type.
SData: Scoped pipeline’s underlying context data type. Must be Send + Sync + 'static.
Err: Error type of the main pipeline AND scoped pipelines. Must be From<OrkaError>.
P: Concrete PipelineProvider<TData, SData, Err> (provides Pipeline<SData, Err>).
Implementations§
Source§impl<'pipeline, TData, SData, Err, P> ConditionalScopeConfigurator<'pipeline, TData, SData, Err, P>
impl<'pipeline, TData, SData, Err, P> ConditionalScopeConfigurator<'pipeline, TData, SData, Err, P>
Sourcepub fn with_merge(
self,
merge_fn: impl Fn(&mut TData, &SData) + Send + Sync + 'static,
) -> Self
pub fn with_merge( self, merge_fn: impl Fn(&mut TData, &SData) + Send + Sync + 'static, ) -> Self
Folds this scope’s context back into the main context after the scoped pipeline completes successfully.
Without this, a scope is detached: the scoped pipeline works on its own ContextData<SData>
and the main context sees nothing of what it did. With it, results land in the parent:
pipeline
.conditional_scopes_for_step("pay")
.add_static_scope(provider_a, |main| Ok(main.project(|d| d.payment.clone())))
.with_merge(|main, sub| main.payment = sub.clone())
.on_condition(|main| main.read().provider == Provider::A)
.finalize_conditional_step(false);The merge runs only when the scoped pipeline succeeds; a failed scope leaves the main context untouched.
Sourcepub fn on_condition(
self,
condition_fn: impl Fn(ContextData<TData>) -> bool + Send + Sync + 'static,
) -> ConditionalScopeBuilder<'pipeline, TData, Err>
pub fn on_condition( self, condition_fn: impl Fn(ContextData<TData>) -> bool + Send + Sync + 'static, ) -> ConditionalScopeBuilder<'pipeline, TData, Err>
Sets the condition for this scope. condition_fn takes ContextData<TData>.
Returns ConditionalScopeBuilder<TData, Err>.