Function dotfiles_core::error::fold_until_first_err

source ยท
pub fn fold_until_first_err<I, Folded, Processed, F, P, E>(
    iterable: I,
    init: Result<Folded, E>,
    process_function: P,
    fold_function: F
) -> Result<Folded, E>
where I: IntoIterator, F: FnMut(Folded, Processed) -> Result<Folded, E>, P: FnMut(I::Item) -> Result<Processed, E>,
Expand description

Executes the process_function on each of the items in the iterable, and folds them using the fold_function. Returns the processed and folded items if all the processing and folding was successful, otherwise returns the first error found.