KeyPathsIterator

Trait KeyPathsIterator 

Source
pub trait KeyPathsIterator: Iterator {
    // Provided methods
    fn map_keypath<V, F, R>(
        self,
        keypath: KeyPaths<Self::Item, V>,
        f: F,
    ) -> Vec<R>
       where Self: Sized,
             Self::Item: KeyPathsOperable,
             F: Fn(&V) -> R { ... }
    fn filter_by_keypath<V, F>(
        self,
        keypath: KeyPaths<Self::Item, V>,
        predicate: F,
    ) -> Vec<Self::Item>
       where Self: Sized,
             Self::Item: KeyPathsOperable,
             F: Fn(&V) -> bool { ... }
    fn find_by_keypath<V, F>(
        self,
        keypath: KeyPaths<Self::Item, V>,
        predicate: F,
    ) -> KeyPathResult<Option<Self::Item>>
       where Self: Sized,
             Self::Item: KeyPathsOperable,
             F: Fn(&V) -> bool { ... }
    fn fold_keypath<V, F, B>(
        self,
        keypath: KeyPaths<Self::Item, V>,
        init: B,
        f: F,
    ) -> KeyPathResult<B>
       where Self: Sized,
             Self::Item: KeyPathsOperable,
             F: FnMut(B, &V) -> B { ... }
    fn collect_keypath<V>(
        self,
        keypath: KeyPaths<Self::Item, V>,
    ) -> KeyPathResult<Vec<V>>
       where Self: Sized,
             Self::Item: KeyPathsOperable,
             V: Clone { ... }
}
Expand description

Trait for iterators that support keypath operations

Provided Methods§

Source

fn map_keypath<V, F, R>(self, keypath: KeyPaths<Self::Item, V>, f: F) -> Vec<R>
where Self: Sized, Self::Item: KeyPathsOperable, F: Fn(&V) -> R,

Map over a keypath in the iterator

Source

fn filter_by_keypath<V, F>( self, keypath: KeyPaths<Self::Item, V>, predicate: F, ) -> Vec<Self::Item>
where Self: Sized, Self::Item: KeyPathsOperable, F: Fn(&V) -> bool,

Filter by a keypath predicate

Source

fn find_by_keypath<V, F>( self, keypath: KeyPaths<Self::Item, V>, predicate: F, ) -> KeyPathResult<Option<Self::Item>>
where Self: Sized, Self::Item: KeyPathsOperable, F: Fn(&V) -> bool,

Find an element by keypath predicate

Source

fn fold_keypath<V, F, B>( self, keypath: KeyPaths<Self::Item, V>, init: B, f: F, ) -> KeyPathResult<B>
where Self: Sized, Self::Item: KeyPathsOperable, F: FnMut(B, &V) -> B,

Fold over a keypath

Source

fn collect_keypath<V>( self, keypath: KeyPaths<Self::Item, V>, ) -> KeyPathResult<Vec<V>>
where Self: Sized, Self::Item: KeyPathsOperable, V: Clone,

Collect values from a keypath

Implementors§