unwrapOrElse method

T unwrapOrElse(
  1. T elseFn()
)

Returns the held value of this Result if it is Ok, or returns the returned value from elseFn if this Result is Err.

See also: Rust: Result::unwrap_or_else()

Implementation

T unwrapOrElse(T Function() elseFn) => switch (this) {
	Ok(value: T value) => value,
	Err() => elseFn()
};