isErrAnd method

bool isErrAnd(
  1. bool predicate(
    1. E
    )
)

Returns whether or not this Result is Err and that the held error value matches the given predicate.

Returns:

  • true if this Result is Err and predicate returns true.
  • false if this Result is Ok, or predicate returns false

See also: Rust: Result::is_err_and()

Implementation

bool isErrAnd(bool Function(E) predicate) {
  return switch (this) {
    Ok() => false,
    Err(:E e) => predicate(e),
  };
}