pub struct CtxDagChain<C, In, Out, Chain> { /* private fields */ }Expand description
Main chain builder for a context-aware DAG.
Chain implements [CtxChainCall<C, E, Out = Out>].
Implementations§
Source§impl<C, In, Out: 'static, Chain> CtxDagChain<C, In, Out, Chain>
impl<C, In, Out: 'static, Chain> CtxDagChain<C, In, Out, Chain>
Sourcepub fn fork(self) -> CtxDagChainFork<C, In, Out, Chain, ()>
pub fn fork(self) -> CtxDagChainFork<C, In, Out, Chain, ()>
Enter fork mode. Subsequent .arm() calls add parallel branches.
Source§impl<C, In, Chain: CtxChainCall<C, In, Out = ()>> CtxDagChain<C, In, (), Chain>
impl<C, In, Chain: CtxChainCall<C, In, Out = ()>> CtxDagChain<C, In, (), Chain>
Source§impl<C, In, Chain: CtxChainCall<C, In, Out = Option<()>>> CtxDagChain<C, In, Option<()>, Chain>
impl<C, In, Chain: CtxChainCall<C, In, Out = Option<()>>> CtxDagChain<C, In, Option<()>, Chain>
Source§impl<Ctx, In, Out: 'static, Chain> CtxDagChain<Ctx, In, Out, Chain>
impl<Ctx, In, Out: 'static, Chain> CtxDagChain<Ctx, In, Out, Chain>
Sourcepub fn then<NewOut, Params, S>(
self,
f: S,
registry: &Registry,
) -> CtxDagChain<Ctx, In, NewOut, CtxDagThenNode<Chain, S::Step, NewOut>>where
NewOut: 'static,
S: IntoCtxStep<Ctx, &'static Out, NewOut, Params>,
S::Step: for<'a> CtxStepCall<Ctx, &'a Out, Out = NewOut> + 'static,
pub fn then<NewOut, Params, S>(
self,
f: S,
registry: &Registry,
) -> CtxDagChain<Ctx, In, NewOut, CtxDagThenNode<Chain, S::Step, NewOut>>where
NewOut: 'static,
S: IntoCtxStep<Ctx, &'static Out, NewOut, Params>,
S::Step: for<'a> CtxStepCall<Ctx, &'a Out, Out = NewOut> + 'static,
Append a step. The step receives &Out by reference.
Sourcepub fn guard<Params, S: IntoCtxRefStep<Ctx, Out, bool, Params>>(
self,
f: S,
registry: &Registry,
) -> CtxDagChain<Ctx, In, Option<Out>, CtxGuardNode<Chain, S::Step>>
pub fn guard<Params, S: IntoCtxRefStep<Ctx, Out, bool, Params>>( self, f: S, registry: &Registry, ) -> CtxDagChain<Ctx, In, Option<Out>, CtxGuardNode<Chain, S::Step>>
Conditionally wrap the output in Option.
Sourcepub fn tap<Params, S: IntoCtxRefStep<Ctx, Out, (), Params>>(
self,
f: S,
registry: &Registry,
) -> CtxDagChain<Ctx, In, Out, CtxTapNode<Chain, S::Step>>
pub fn tap<Params, S: IntoCtxRefStep<Ctx, Out, (), Params>>( self, f: S, registry: &Registry, ) -> CtxDagChain<Ctx, In, Out, CtxTapNode<Chain, S::Step>>
Observe the current value without consuming or changing it.
Source§impl<Ctx, In, T: 'static, Chain> CtxDagChain<Ctx, In, Option<T>, Chain>
impl<Ctx, In, T: 'static, Chain> CtxDagChain<Ctx, In, Option<T>, Chain>
Sourcepub fn map<U, Params, S>(
self,
f: S,
registry: &Registry,
) -> CtxDagChain<Ctx, In, Option<U>, CtxDagMapOptionNode<Chain, S::Step, U>>where
U: 'static,
S: IntoCtxStep<Ctx, &'static T, U, Params>,
S::Step: for<'x> CtxStepCall<Ctx, &'x T, Out = U>,
pub fn map<U, Params, S>(
self,
f: S,
registry: &Registry,
) -> CtxDagChain<Ctx, In, Option<U>, CtxDagMapOptionNode<Chain, S::Step, U>>where
U: 'static,
S: IntoCtxStep<Ctx, &'static T, U, Params>,
S::Step: for<'x> CtxStepCall<Ctx, &'x T, Out = U>,
Transform the inner value. Step not called on None.
Sourcepub fn and_then<U, Params, S>(
self,
f: S,
registry: &Registry,
) -> CtxDagChain<Ctx, In, Option<U>, CtxDagAndThenOptionNode<Chain, S::Step, U>>where
U: 'static,
S: IntoCtxStep<Ctx, &'static T, Option<U>, Params>,
S::Step: for<'x> CtxStepCall<Ctx, &'x T, Out = Option<U>>,
pub fn and_then<U, Params, S>(
self,
f: S,
registry: &Registry,
) -> CtxDagChain<Ctx, In, Option<U>, CtxDagAndThenOptionNode<Chain, S::Step, U>>where
U: 'static,
S: IntoCtxStep<Ctx, &'static T, Option<U>, Params>,
S::Step: for<'x> CtxStepCall<Ctx, &'x T, Out = Option<U>>,
Short-circuits on None. std: Option::and_then
Sourcepub fn on_none<Params, S: IntoCtxProducer<Ctx, (), Params>>(
self,
f: S,
registry: &Registry,
) -> CtxDagChain<Ctx, In, Option<T>, CtxOnNoneNode<Chain, S::Step>>
pub fn on_none<Params, S: IntoCtxProducer<Ctx, (), Params>>( self, f: S, registry: &Registry, ) -> CtxDagChain<Ctx, In, Option<T>, CtxOnNoneNode<Chain, S::Step>>
Side effect on None.
Sourcepub fn filter<Params, S: IntoCtxRefStep<Ctx, T, bool, Params>>(
self,
f: S,
registry: &Registry,
) -> CtxDagChain<Ctx, In, Option<T>, CtxFilterNode<Chain, S::Step>>
pub fn filter<Params, S: IntoCtxRefStep<Ctx, T, bool, Params>>( self, f: S, registry: &Registry, ) -> CtxDagChain<Ctx, In, Option<T>, CtxFilterNode<Chain, S::Step>>
Keep value if predicate holds. std: Option::filter
Sourcepub fn inspect<Params, S: IntoCtxRefStep<Ctx, T, (), Params>>(
self,
f: S,
registry: &Registry,
) -> CtxDagChain<Ctx, In, Option<T>, CtxInspectOptionNode<Chain, S::Step>>
pub fn inspect<Params, S: IntoCtxRefStep<Ctx, T, (), Params>>( self, f: S, registry: &Registry, ) -> CtxDagChain<Ctx, In, Option<T>, CtxInspectOptionNode<Chain, S::Step>>
Side effect on Some value. std: Option::inspect
Sourcepub fn ok_or<E: Clone>(
self,
err: E,
) -> CtxDagChain<Ctx, In, Result<T, E>, CtxOkOrNode<Chain, E>>
pub fn ok_or<E: Clone>( self, err: E, ) -> CtxDagChain<Ctx, In, Result<T, E>, CtxOkOrNode<Chain, E>>
None becomes Err(err). std: Option::ok_or
Sourcepub fn unwrap_or(
self,
default: T,
) -> CtxDagChain<Ctx, In, T, CtxUnwrapOrOptionNode<Chain, T>>where
T: Clone,
pub fn unwrap_or(
self,
default: T,
) -> CtxDagChain<Ctx, In, T, CtxUnwrapOrOptionNode<Chain, T>>where
T: Clone,
Exit Option — None becomes the default value.
Sourcepub fn unwrap_or_else<Params, S: IntoCtxProducer<Ctx, T, Params>>(
self,
f: S,
registry: &Registry,
) -> CtxDagChain<Ctx, In, T, CtxUnwrapOrElseOptionNode<Chain, S::Step>>
pub fn unwrap_or_else<Params, S: IntoCtxProducer<Ctx, T, Params>>( self, f: S, registry: &Registry, ) -> CtxDagChain<Ctx, In, T, CtxUnwrapOrElseOptionNode<Chain, S::Step>>
Exit Option — None becomes f().
Source§impl<Ctx, In, T: 'static, Err: 'static, Chain> CtxDagChain<Ctx, In, Result<T, Err>, Chain>
impl<Ctx, In, T: 'static, Err: 'static, Chain> CtxDagChain<Ctx, In, Result<T, Err>, Chain>
Sourcepub fn map<U, Params, S>(
self,
f: S,
registry: &Registry,
) -> CtxDagChain<Ctx, In, Result<U, Err>, CtxDagMapResultNode<Chain, S::Step, U>>where
U: 'static,
S: IntoCtxStep<Ctx, &'static T, U, Params>,
S::Step: for<'x> CtxStepCall<Ctx, &'x T, Out = U>,
pub fn map<U, Params, S>(
self,
f: S,
registry: &Registry,
) -> CtxDagChain<Ctx, In, Result<U, Err>, CtxDagMapResultNode<Chain, S::Step, U>>where
U: 'static,
S: IntoCtxStep<Ctx, &'static T, U, Params>,
S::Step: for<'x> CtxStepCall<Ctx, &'x T, Out = U>,
Transform the Ok value. Step not called on Err.
Sourcepub fn and_then<U, Params, S>(
self,
f: S,
registry: &Registry,
) -> CtxDagChain<Ctx, In, Result<U, Err>, CtxDagAndThenResultNode<Chain, S::Step, U>>where
U: 'static,
S: IntoCtxStep<Ctx, &'static T, Result<U, Err>, Params>,
S::Step: for<'x> CtxStepCall<Ctx, &'x T, Out = Result<U, Err>>,
pub fn and_then<U, Params, S>(
self,
f: S,
registry: &Registry,
) -> CtxDagChain<Ctx, In, Result<U, Err>, CtxDagAndThenResultNode<Chain, S::Step, U>>where
U: 'static,
S: IntoCtxStep<Ctx, &'static T, Result<U, Err>, Params>,
S::Step: for<'x> CtxStepCall<Ctx, &'x T, Out = Result<U, Err>>,
Short-circuits on Err. std: Result::and_then
Sourcepub fn catch<Params, S>(
self,
f: S,
registry: &Registry,
) -> CtxDagChain<Ctx, In, Option<T>, CtxDagCatchNode<Chain, S::Step>>where
S: IntoCtxStep<Ctx, &'static Err, (), Params>,
S::Step: for<'x> CtxStepCall<Ctx, &'x Err, Out = ()>,
pub fn catch<Params, S>(
self,
f: S,
registry: &Registry,
) -> CtxDagChain<Ctx, In, Option<T>, CtxDagCatchNode<Chain, S::Step>>where
S: IntoCtxStep<Ctx, &'static Err, (), Params>,
S::Step: for<'x> CtxStepCall<Ctx, &'x Err, Out = ()>,
Handle error and transition to Option.
Sourcepub fn map_err<E2, Params, S: IntoCtxStep<Ctx, Err, E2, Params>>(
self,
f: S,
registry: &Registry,
) -> CtxDagChain<Ctx, In, Result<T, E2>, CtxMapErrNode<Chain, S::Step>>
pub fn map_err<E2, Params, S: IntoCtxStep<Ctx, Err, E2, Params>>( self, f: S, registry: &Registry, ) -> CtxDagChain<Ctx, In, Result<T, E2>, CtxMapErrNode<Chain, S::Step>>
Transform the error. std: Result::map_err
Sourcepub fn inspect<Params, S: IntoCtxRefStep<Ctx, T, (), Params>>(
self,
f: S,
registry: &Registry,
) -> CtxDagChain<Ctx, In, Result<T, Err>, CtxInspectResultNode<Chain, S::Step>>
pub fn inspect<Params, S: IntoCtxRefStep<Ctx, T, (), Params>>( self, f: S, registry: &Registry, ) -> CtxDagChain<Ctx, In, Result<T, Err>, CtxInspectResultNode<Chain, S::Step>>
Side effect on Ok value. std: Result::inspect
Sourcepub fn inspect_err<Params, S: IntoCtxRefStep<Ctx, Err, (), Params>>(
self,
f: S,
registry: &Registry,
) -> CtxDagChain<Ctx, In, Result<T, Err>, CtxInspectErrNode<Chain, S::Step>>
pub fn inspect_err<Params, S: IntoCtxRefStep<Ctx, Err, (), Params>>( self, f: S, registry: &Registry, ) -> CtxDagChain<Ctx, In, Result<T, Err>, CtxInspectErrNode<Chain, S::Step>>
Side effect on Err. std: Result::inspect_err
Sourcepub fn ok(self) -> CtxDagChain<Ctx, In, Option<T>, CtxOkNode<Chain>>
pub fn ok(self) -> CtxDagChain<Ctx, In, Option<T>, CtxOkNode<Chain>>
Discard error, enter Option land. std: Result::ok
Sourcepub fn unwrap_or(
self,
default: T,
) -> CtxDagChain<Ctx, In, T, CtxUnwrapOrResultNode<Chain, T>>where
T: Clone,
pub fn unwrap_or(
self,
default: T,
) -> CtxDagChain<Ctx, In, T, CtxUnwrapOrResultNode<Chain, T>>where
T: Clone,
Exit Result — Err becomes the default value.