or<F> method

Result<T, F> or<F>(
  1. Result<T, F> other
)

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

See also: Rust: Result::or()

Implementation

Result<T, F> or<F>(Result<T, F> other) {
  return switch (this) {
    Ok(:T v) => Ok(v),
    Err() => other,
  };
}