or<F> abstract method

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

Returns an Ok of the original value if this is an Ok, or other otherwise.

Examples

// prints "Ok(2)"
print(const Ok<int, String>(2).or(const Ok<int, String>(3)));

// prints "Ok(3)"
print(const Err<int, String>('error').or(const Ok<int, String>(3)));

Implementation

@useResult
Result<T, F> or<F>(Result<T, F> other);