tryForEach method

Result<(), E> tryForEach(
  1. void f(
    1. T
    )
)

An iterator method that applies a function, stopping at the first Err and returning that Err.

Implementation

Result<(), E> tryForEach(void Function(T) f) {
  for (final res in this) {
    if (res.isErr()) {
      return res.intoUnchecked();
    }
    f(res.unwrap());
  }
  return const Ok(());
}