TryIteratorExt

Trait TryIteratorExt 

Source
pub trait TryIteratorExt<T, E>: Iterator<Item = Result<T, E>> + Sized {
    // Provided methods
    fn try_map_while_and_collect<U, P, B>(self, predicate: P) -> B
       where P: FnMut(T) -> Option<U>,
             B: FromIterator<Result<U, E>> { ... }
    fn try_take_map_while_and_collect<U, F, P, B>(
        self,
        limit: Option<usize>,
        predicate: P,
        map_fn: F,
    ) -> Result<B, E>
       where F: Fn(T) -> U,
             P: FnMut(&T) -> bool,
             B: FromIterator<U> { ... }
}

Provided Methods§

Source

fn try_map_while_and_collect<U, P, B>(self, predicate: P) -> B
where P: FnMut(T) -> Option<U>, B: FromIterator<Result<U, E>>,

Tries to map and collect items from a fallible iterator, stopping early on the first error.

Source

fn try_take_map_while_and_collect<U, F, P, B>( self, limit: Option<usize>, predicate: P, map_fn: F, ) -> Result<B, E>
where F: Fn(T) -> U, P: FnMut(&T) -> bool, B: FromIterator<U>,

Try taking at most limit items while predicate holds collecting mapped values and breaking early on errors.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<I, T, E> TryIteratorExt<T, E> for I
where I: Iterator<Item = Result<T, E>>,