unwrapOr method

T unwrapOr(
  1. T orValue
)

Returns the held value of this Option if it is Some, or the given value if this Option is None.

See also: Rust: Option::unwrap_or()

Implementation

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