Reduce

Trait Reduce 

Source
pub trait Reduce: Iterator + Sized {
    // Provided methods
    fn reduce_with<R>(self) -> R
       where R: Reductor<Self::Item>,
             R::State: Default { ... }
    fn fold_with<R, I>(self, init: I) -> R
       where R: Reductor<Self::Item>,
             R::State: From<I> { ... }
}
Expand description

Allow reducing an Iterator with a Reductor.

Provided Methods§

Source

fn reduce_with<R>(self) -> R
where R: Reductor<Self::Item>, R::State: Default,

Similar to Iterator::reduce, but uses a generic implementation of Reductor, instead of a function parameter, to supply the reduction logic.

Source

fn fold_with<R, I>(self, init: I) -> R
where R: Reductor<Self::Item>, R::State: From<I>,

Similar to Iterator::fold, but uses a generic implementation of Reductor, instead of a function parameter, to supply the reduction logic.

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> Reduce for I
where I: Iterator,