fn interleave_shortest<X, I>(self, other: X) -> Interleave<Take<Self>, Take<X::Iter>>
    where
        X: IntoParallelIterator<'a, Item = I>,
        X::Iter: IndexedParallelIterator<'a, Item = I> + WithIndexedProducer<'a, Item = I>,
        Self: IndexedParallelIterator<'a, Item = I> + WithIndexedProducer<'a, Item = I>,
        I: Send + 'a,
    {
        let a = self;
        let b = other.into_par_iter();

        let len_a = a.len_hint();
        let len_b = b.len_hint();

        if len_a <= len_b {
            a.take(len_a).interleave(b.take(len_a))
        } else {
            a.take(len_b + 1).interleave(b.take(len_b))
        }
    }
/// Interleaves elements of this iterator and the other given
/// iterator, until one is exhausted.
///
/// # Examples
///
/// ```
/// use asparit::*;
/// let (x, y) = (vec![1, 2, 3, 4], vec![5, 6]);
/// let r: Vec<i32> = x.into_par_iter().interleave_shortest(y).collect().exec();
/// assert_eq!(r, vec![1, 5, 2, 6, 3]);
/// ```
Interleaves elements of this iterator and the other given
iterator, until one is exhausted.
Interleaves elements of this iterator and the other given iterator until one is exhausted .
fn interleave_shortest<X, I>(self, other: X) -> Interleave<Take<Self>, Take<X::Iter>>
    where
        X: IntoParallelIterator<'a, Item = I>,
        X::Iter: IndexedParallelIterator<'a, Item = I> + WithIndexedProducer<'a, Item = I>,
        Self: IndexedParallelIterator<'a, Item = I> + WithIndexedProducer<'a, Item = I>,
        I: Send + 'a,
    {
        let a = self;
        let b = other.into_par_iter();
        let len_a = a.len_hint();
        let len_b = b.len_hint();
        if len_a <= len_b {
            a.take(len_a).interleave(b.take(len_a))
        } else {
            a.take(len_b + 1).interleave(b.take(len_b))
        }
    }
fn interleave_shortest < X , I > ( self , other : X ) -> Interleave < Take < Self > , Take < X :: Iter > > where X : IntoParallelIterator < ' a , Item = I > , X :: Iter : IndexedParallelIterator < ' a , Item = I > + WithIndexedProducer < ' a , Item = I > , Self : IndexedParallelIterator < ' a , Item = I > + WithIndexedProducer < ' a , Item = I > , I : Send + ' a , { let a = self ; let b = other . into_par_iter ( ) ; let len_a = a . len_hint ( ) ; let len_b = b . len_hint ( ) ; if len_a <= len_b { a . take ( len_a ) . interleave ( b . take ( len_a ) ) } else { a . take ( len_b + 1 ) . interleave ( b . take ( len_b ) ) } }
Interleaves elements of this iterator and the other given
iterator, until one is exhausted.
Interleaves elements of this iterator and the other given iterator until one is exhausted .
self
other
X
self
other
X
examples
None