ComposableIterator

Trait ComposableIterator 

Source
pub trait ComposableIterator<T>: Iterator<Item = T> {
    // Provided methods
    fn pipe<F, R>(self, f: F) -> R
       where Self: Sized,
             F: FnOnce(Self) -> R { ... }
    fn chain_keypath_ops(self) -> KeyPathsChain<T>
       where Self: Sized { ... }
    fn when_keypath<V, F, G, R>(
        self,
        keypath: KeyPaths<T, V>,
        condition: F,
        operation: G,
    ) -> KeyPathResult<Vec<R>>
       where Self: Sized,
             F: Fn(&V) -> bool,
             G: FnOnce(IntoIter<T>) -> IntoIter<R> { ... }
    fn unless_keypath<V, F, G, R>(
        self,
        keypath: KeyPaths<T, V>,
        condition: F,
        operation: G,
    ) -> KeyPathResult<Vec<R>>
       where Self: Sized,
             F: Fn(&V) -> bool,
             G: FnOnce(IntoIter<T>) -> IntoIter<R> { ... }
}
Expand description

Extension trait for adding composable operations to iterators

Provided Methods§

Source

fn pipe<F, R>(self, f: F) -> R
where Self: Sized, F: FnOnce(Self) -> R,

Pipe the iterator through a function

Source

fn chain_keypath_ops(self) -> KeyPathsChain<T>
where Self: Sized,

Chain keypath operations

Source

fn when_keypath<V, F, G, R>( self, keypath: KeyPaths<T, V>, condition: F, operation: G, ) -> KeyPathResult<Vec<R>>
where Self: Sized, F: Fn(&V) -> bool, G: FnOnce(IntoIter<T>) -> IntoIter<R>,

Apply operation when condition is met

Source

fn unless_keypath<V, F, G, R>( self, keypath: KeyPaths<T, V>, condition: F, operation: G, ) -> KeyPathResult<Vec<R>>
where Self: Sized, F: Fn(&V) -> bool, G: FnOnce(IntoIter<T>) -> IntoIter<R>,

Apply operation unless condition is met

Implementors§