unwrapOr method

T unwrapOr(
  1. T orValue
)

Returns the held value of this Result if it is Ok, or the given value if this Result is Err.

See also: Rust: Result::unwrap_or()

Implementation

T unwrapOr(T orValue) {
  return switch (this) {
    Ok(:T v) => v,
    Err() => orValue,
  };
}