[][src]Struct cor_iter::CorIter

pub struct CorIter<F, I, J> where
    F: FnMut(Either<&I::Item, &J::Item>) -> bool,
    I: Iterator,
    J: Iterator
{ /* fields omitted */ }

An iterator that keep return next item either in I or J depending on whether F return true or false. If F return true, next item will come from I. If F return false, next item will come from J. If either of I or J is exhausted, it will consider this iterator exhausted.

The behavior can be summarise as table below:

IJF
x-T
x-F
-xT
x-F
-xF
-xT
x-T
---

x can either be in column I or column J but not both. If x is in in column I, it mean the iterator return an item from I. If x is in column J, it mean iterator return an item from J. The possible value in column F is either T or F. T mean function F return true. F mean function F return false.

This iterator is one step eager. This mean that when construct, it will iterate once on primary iterator. Each subsequence iteration will always have one step ahead iterate.

The first value always come from primary iterator. The return value from function F only effect next item.

It is impossible to simulate linear correlate iterator where b is negative. This is because this iterator always return one item from primary iterator first.

Implementations

impl<F, I, J> CorIter<F, I, J> where
    F: FnMut(Either<&I::Item, &J::Item>) -> bool,
    I: Iterator,
    J: Iterator
[src]

pub fn new(formula: F, primary: I, secondary: J) -> CorIter<F, I, J>

Important traits for CorIter<F, I, J>

impl<F, I, J> Iterator for CorIter<F, I, J> where
    F: FnMut(Either<&I::Item, &J::Item>) -> bool,
    I: Iterator,
    J: Iterator
type Item = Either<I::Item, J::Item>;
[src]

Trait Implementations

impl<F: Debug, I: Debug, J: Debug> Debug for CorIter<F, I, J> where
    F: FnMut(Either<&I::Item, &J::Item>) -> bool,
    I: Iterator,
    J: Iterator,
    I::Item: Debug,
    J::Item: Debug
[src]

impl<F, I, J> Iterator for CorIter<F, I, J> where
    F: FnMut(Either<&I::Item, &J::Item>) -> bool,
    I: Iterator,
    J: Iterator
[src]

type Item = Either<I::Item, J::Item>

The type of the elements being iterated over.

Auto Trait Implementations

impl<F, I, J> RefUnwindSafe for CorIter<F, I, J> where
    F: RefUnwindSafe,
    I: RefUnwindSafe,
    J: RefUnwindSafe,
    <I as Iterator>::Item: RefUnwindSafe,
    <J as Iterator>::Item: RefUnwindSafe

impl<F, I, J> Send for CorIter<F, I, J> where
    F: Send,
    I: Send,
    J: Send,
    <I as Iterator>::Item: Send,
    <J as Iterator>::Item: Send

impl<F, I, J> Sync for CorIter<F, I, J> where
    F: Sync,
    I: Sync,
    J: Sync,
    <I as Iterator>::Item: Sync,
    <J as Iterator>::Item: Sync

impl<F, I, J> Unpin for CorIter<F, I, J> where
    F: Unpin,
    I: Unpin,
    J: Unpin,
    <I as Iterator>::Item: Unpin,
    <J as Iterator>::Item: Unpin

impl<F, I, J> UnwindSafe for CorIter<F, I, J> where
    F: UnwindSafe,
    I: UnwindSafe,
    J: UnwindSafe,
    <I as Iterator>::Item: UnwindSafe,
    <J as Iterator>::Item: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Correlate for T where
    T: IntoIterator
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.