Function bicoro::dispatch

source ·
pub fn dispatch<'a, I, IA, IB, IAB, O, A, B, F>(
    selector: F,
    first: Coroutine<'a, IA, O, A>,
    second: Coroutine<'a, IB, O, B>
) -> Coroutine<'a, I, O, DispatchResult<'a, IA, IB, O, A, B>>where
    F: Fn(I) -> Select<IA, IB, IAB> + Send + 'a,
    IAB: Into<IA> + Into<IB> + Clone,
    O: Send,
    A: Send,
    B: Send,
Expand description

Run two co-routines, sharing inputs depending on selector.

This can be thought of as running them almost in parralel. Selector will route the input as needed to coroutines a and b Values that can be sent to both, if the selector selects both and the both value is cloneable and convertable