and<U> method

Result<U, E> and<U>(
  1. Result<U, E> other
)

Returns a Result value as Err<U, E> if this Result is Err<T, E>, otherwise returns other.

See also: Rust: Result::and()

Implementation

Result<U, E> and<U>(Result<U, E> other) {
  return switch (this) {
    Ok() => other,
    Err(:E e) => Err(e),
  };
}