Trait IterExt

Source
pub trait IterExt<T, E>: Iterator<Item = NullableResult<T, E>>
where Self: Sized,
{ // Provided methods fn filter_nulls( self, ) -> FilterMap<Self, fn(NullableResult<T, E>) -> Option<Result<T, E>>> { ... } fn extract_and_find<P>(self, pred: P) -> NullableResult<T, E> where P: FnMut(&T) -> Result<bool, E> { ... } fn extract_and_find_map<F, U>(self, f: F) -> NullableResult<U, E> where F: FnMut(T) -> NullableResult<U, E> { ... } fn try_filter<P>(self, pred: P) -> TryFilter<Self, P, T, E> where P: FnMut(&T) -> bool { ... } fn try_filter_map<F, U>(self, f: F) -> TryFilterMap<Self, F, T, U, E> where F: FnMut(T) -> Option<NullableResult<U, E>> { ... } }
Expand description

Additional methods for iterators over NullableResult

Provided Methods§

Source

fn filter_nulls( self, ) -> FilterMap<Self, fn(NullableResult<T, E>) -> Option<Result<T, E>>>

Filter out all the null values. Returns an iterator over Result<T, E>.

Source

fn extract_and_find<P>(self, pred: P) -> NullableResult<T, E>
where P: FnMut(&T) -> Result<bool, E>,

Returns the first value that is an Err or that the predicate accepts.

Source

fn extract_and_find_map<F, U>(self, f: F) -> NullableResult<U, E>
where F: FnMut(T) -> NullableResult<U, E>,

Applies the function to each element until it finds one that the function returns Ok or Err and returns that value.

Source

fn try_filter<P>(self, pred: P) -> TryFilter<Self, P, T, E>
where P: FnMut(&T) -> bool,

Returns an iterator that applies the predicate to each element and filters out the values for which it returns false.

Source

fn try_filter_map<F, U>(self, f: F) -> TryFilterMap<Self, F, T, U, E>
where F: FnMut(T) -> Option<NullableResult<U, E>>,

Returns an iterator that both filters and maps.

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> IterExt<T, E> for I
where I: Iterator<Item = NullableResult<T, E>>,