pub fn try_sync_by_key<I, F, K, T, E, S>(
    buf_size: impl Into<Option<usize>>,
    key_fn: F,
    streams: I
) -> BoxStream<'static, Result<Result<(usize, T), (usize, T)>, E>> where
    I: IntoIterator<Item = S>,
    S: 'static + Stream<Item = Result<T, E>> + Send,
    T: 'static + Send,
    E: 'static + Send,
    F: 'static + Fn(&T) -> K + Send,
    K: 'static + Clone + Ord + Send
Expand description

Synchronize streams by pairing up keys of each stream item. It is fallible counterpart of sync_by_key.

The key_fn constructs the key for each item. The input items are grouped by their keys in the interal buffer until all items with the key arrives. The finished items are yielded in type Ok(Ok((stream_index, item))) in monotonic manner.

If any one of the streams generates a non-monotonic item. The item is yielded as Ok(Err((stream_index, item))) immediately.

When an error is receiver from one of the streams. The returned stream yields Err(err) and no longer produce future items.