fn fold_with<U, O>(self, init: U, operation: O) -> FoldWith<Self, U, O>
    where
        U: Clone + Send + 'a,
        O: Fn(U, Self::Item) -> U + Clone + Send + 'a,
    {
        FoldWith::new(self, init, operation)
    }
/// Applies `operation` to the given `init` value with each item of this
/// iterator, finally producing the value for further use.
///
/// This works essentially like `fold(|| init.clone(), operation)`, except
/// it doesn't require the `init` type to be `Sync`, nor any other form
/// of added synchronization.
///
/// # Examples
///
/// ```
/// use asparit::*;
///
/// let bytes = 0..22_u8;
/// let sum = bytes
///     .into_par_iter()
///     .fold_with(0_u32, |a: u32, b: u8| a + (b as u32))
///     .sum::<u32>()
///     .exec();
///
/// assert_eq!(sum, (0..22).sum()); // compare to sequential
/// ```
Applies `operation` to the given `init` value with each item of this
iterator, finally producing the value for further use.


Applies ` operation ` to the given ` init ` value with each item of this iterator finally producing the value for further use .
fn fold_with<U, O>(self, init: U, operation: O) -> FoldWith<Self, U, O>
    where
        U: Clone + Send + 'a,
        O: Fn(U, Self::Item) -> U + Clone + Send + 'a,
    {
        FoldWith::new(self, init, operation)
    }
fn fold_with < U , O > ( self , init : U , operation : O ) -> FoldWith < Self , U , O > where U : Clone + Send + ' a , O : Fn ( U , Self :: Item ) -> U + Clone + Send + ' a , { FoldWith :: new ( self , init , operation ) }
Applies `operation` to the given `init` value with each item of this
iterator, finally producing the value for further use.
Applies ` operation ` to the given ` init ` value with each item of this iterator finally producing the value for further use .
self
init
U
operation
O
self
init
U
operation
O
examples
None