tryFold<U> method
Result<U, E>
tryFold<U>(
- U initial,
- U f(
- U,
- T
An iterator method that applies a function producing a single value, returns Err is encounted.
Implementation
Result<U, E> tryFold<U>(U initial, U Function(U, T) f) {
var accum = initial;
for (final res in this) {
if (res.isErr()) {
return res.intoUnchecked();
}
accum = f(accum, res.unwrap());
}
return Ok(accum);
}