Extracts the value from a successful result, or computes a fallback from the error.
The result to unwrap.
Computes a fallback from the error.
The success value or the computed fallback.
resultUnwrapOrElse({ ok: true, value: 42 }, () => 0); // 42resultUnwrapOrElse({ ok: false, error: e }, () => -1); // -1 Copy
resultUnwrapOrElse({ ok: true, value: 42 }, () => 0); // 42resultUnwrapOrElse({ ok: false, error: e }, () => -1); // -1
Extracts the value from a successful result, or computes a fallback from the error.