Trait IteratorExt

Source
pub trait IteratorExt {
    // Provided methods
    fn try_scan<St, F, T, U, E>(self, init: St, f: F) -> TryScan<Self, St, F> 
       where Self: Sized + Iterator<Item = Result<T, E>>,
             F: FnMut(&mut St, T) -> Result<Option<U>, E> { ... }
    fn try_flat_map<F, T, U, V, E>(
        self,
        f: F,
    ) -> TryFlatMap<Self, F, U::IntoIter> 
       where Self: Sized + Iterator<Item = Result<T, E>>,
             F: FnMut(T) -> Result<U, E>,
             U: IntoIterator<Item = V> { ... }
    fn try_flatten<T, U, E>(self) -> TryFlatten<Self, T::IntoIter> 
       where Self: Sized + Iterator<Item = Result<T, E>>,
             T: IntoIterator<Item = U> { ... }
    fn try_flat_map_results<F, T, U, V, E>(
        self,
        f: F,
    ) -> TryFlatMapResults<Self, F, U::IntoIter> 
       where Self: Sized + Iterator<Item = Result<T, E>>,
             F: FnMut(T) -> Result<U, E>,
             U: IntoIterator<Item = Result<V, E>> { ... }
    fn try_flatten_results<T, U, E>(
        self,
    ) -> TryFlattenResults<Self, T::IntoIter> 
       where Self: Sized + Iterator<Item = Result<T, E>>,
             T: IntoIterator<Item = Result<U, E>> { ... }
    fn try_filter<F, T, E>(self, f: F) -> TryFilter<Self, F> 
       where Self: Sized + Iterator<Item = Result<T, E>>,
             F: FnMut(&T) -> Result<bool, E> { ... }
    fn try_filter_map<F, T, U, E>(self, f: F) -> TryFilterMap<Self, F> 
       where Self: Sized + Iterator<Item = Result<T, E>>,
             F: FnMut(T) -> Result<Option<U>, E> { ... }
    fn map_err<F, Ein, Eout>(self, f: F) -> MapErr<Self, F> 
       where Self: Sized,
             F: FnMut(Ein) -> Eout { ... }
    fn and_then<F, T, U, E>(self, f: F) -> AndThen<Self, F> 
       where Self: Sized + Iterator<Item = Result<T, E>>,
             F: FnMut(T) -> Result<U, E> { ... }
}
Expand description

An extension trait to Iterator

Provided Methods§

Source

fn try_scan<St, F, T, U, E>(self, init: St, f: F) -> TryScan<Self, St, F>
where Self: Sized + Iterator<Item = Result<T, E>>, F: FnMut(&mut St, T) -> Result<Option<U>, E>,

A fallible iterator adaptor analogous to scan from Iterator.

Source

fn try_flat_map<F, T, U, V, E>(self, f: F) -> TryFlatMap<Self, F, U::IntoIter>
where Self: Sized + Iterator<Item = Result<T, E>>, F: FnMut(T) -> Result<U, E>, U: IntoIterator<Item = V>,

Creates a fallible iterator that works like map, but flattens nested structure.

Source

fn try_flatten<T, U, E>(self) -> TryFlatten<Self, T::IntoIter>
where Self: Sized + Iterator<Item = Result<T, E>>, T: IntoIterator<Item = U>,

Creates a fallible iterator that flattens nested structure.

Source

fn try_flat_map_results<F, T, U, V, E>( self, f: F, ) -> TryFlatMapResults<Self, F, U::IntoIter>
where Self: Sized + Iterator<Item = Result<T, E>>, F: FnMut(T) -> Result<U, E>, U: IntoIterator<Item = Result<V, E>>,

Similar to try_flat_map, but flattens nested results.

Source

fn try_flatten_results<T, U, E>(self) -> TryFlattenResults<Self, T::IntoIter>
where Self: Sized + Iterator<Item = Result<T, E>>, T: IntoIterator<Item = Result<U, E>>,

Similar to try_flatten, but flattens nested results.

Source

fn try_filter<F, T, E>(self, f: F) -> TryFilter<Self, F>
where Self: Sized + Iterator<Item = Result<T, E>>, F: FnMut(&T) -> Result<bool, E>,

Creates a fallible iterator that filters items.

Source

fn try_filter_map<F, T, U, E>(self, f: F) -> TryFilterMap<Self, F>
where Self: Sized + Iterator<Item = Result<T, E>>, F: FnMut(T) -> Result<Option<U>, E>,

Creates a fallible iterator that both filters and maps.

Source

fn map_err<F, Ein, Eout>(self, f: F) -> MapErr<Self, F>
where Self: Sized, F: FnMut(Ein) -> Eout,

Maps a Result<T, E> to Result<T, F> by applying a function to a contained Err value, leaving an Ok value untouched.

Source

fn and_then<F, T, U, E>(self, f: F) -> AndThen<Self, F>
where Self: Sized + Iterator<Item = Result<T, E>>, F: FnMut(T) -> Result<U, E>,

Takes a closure and creates a fallible iterator which calls that closure on each element.

Implementors§

Source§

impl<I> IteratorExt for I
where I: Iterator,