Function bicoro::race

source · []
pub fn race<'a, I, O, A, B>(
    a: Coroutine<'a, I, O, A>,
    b: Coroutine<'a, I, O, B>
) -> Coroutine<'a, I, O, RaceResult<'a, I, O, A, B>>where
    I: Clone,
Expand description

Run both coroutines, and returns which finishes first For each step this feeds inputs to left first, then right so if they are equal, left will return first Raceresult returns the value, and the remaining coroutine, so it can be ran elsewhere

Input must be clone-able, as it needs to be consumed by both routines