Function bicoro::subroutine_result

source ·
pub fn subroutine_result<'a, I, O, SI, SO, FI, FO, R, E>(
    on_input: FI,
    on_output: FO,
    subroutine: Coroutine<'a, SI, SO, Result<R, E>>
) -> Coroutine<'a, I, O, Result<R, E>>where
    FI: Fn() -> Coroutine<'a, I, O, Result<SI, E>> + Send + 'a,
    FO: Fn(SO) -> Coroutine<'a, I, O, Option<E>> + Send + 'a,
    SO: Send,
    R: Send,
    E: Send,
Expand description

Run a child subroutine, with routines that map inputs and outputs

This is special over the core-lib version, as we work in results a err in input procesisng, or output processing, will shortcircuit the whole computation into the err value.

It is unexpected that an output routine should fail, but provided for convenience