Trait GeneralIterExt

Source
pub trait GeneralIterExt: Iterator {
    // Required methods
    fn try_find<E, P>(self, pred: P) -> NullableResult<Self::Item, E>
       where P: FnMut(&Self::Item) -> Result<bool, E>;
    fn try_find_map<T, E, F>(self, f: F) -> NullableResult<T, E>
       where F: FnMut(Self::Item) -> NullableResult<T, E>;
    fn maybe_try_fold<T, E, Op>(
        &mut self,
        init: T,
        op: Op,
    ) -> NullableResult<T, E>
       where Op: FnMut(T, Self::Item) -> NullableResult<T, E>;
}
Expand description

Adds additional methods to all iterators.

Required Methods§

Source

fn try_find<E, P>(self, pred: P) -> NullableResult<Self::Item, E>
where P: FnMut(&Self::Item) -> Result<bool, E>,

Applies the predicate to the elements of the iterator and returns the first true result or the first error.

Source

fn try_find_map<T, E, F>(self, f: F) -> NullableResult<T, E>
where F: FnMut(Self::Item) -> NullableResult<T, E>,

Applies the function to the elements of the iterator and returns the first value that isn’t Null

Source

fn maybe_try_fold<T, E, Op>(&mut self, init: T, op: Op) -> NullableResult<T, E>
where Op: FnMut(T, Self::Item) -> NullableResult<T, E>,

Fold the elements of the iterator using the given initial value and operation. Returns early if the operation does not return Ok.

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§