Add valueOrRethrow to Result#969
Conversation
This is the synchronous version of `asFuture`. Typical uses of `Result` are asynchronous and the `asFuture` API is sufficient, but we already have the APIs available for checking `isValue` and reading the value with `.asValue?.value` so a synchronous counterpart is easy to implement.
PR HealthUnused Dependencies ✔️
For details on how to fix these, see dependency_validator. This check can be disabled by tagging the PR with Breaking changes ✔️
This check can be disabled by tagging the PR with API leaks ✔️The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.
This check can be disabled by tagging the PR with Changelog Entry ✔️
Changes to files need to be accounted for in their respective changelogs. This check can be disabled by tagging the PR with Coverage ✔️
This check for test coverage is informational (issues shown here will not fail the PR). This check can be disabled by tagging the PR with License Headers ✔️
All source files should start with a license header. Unrelated files missing license headers
This check can be disabled by tagging the PR with |
|
We could also write this as an extension getter easily, but I think that these classes were not designed to be extended and it may be worth the potentially breaking change to mark them |
This is the synchronous version of
asFuture. Typical uses ofResultare asynchronous and the
asFutureAPI is sufficient, but we alreadyhave the APIs available for checking
isValueand reading the valuewith
.asValue?.valueso a synchronous counterpart is easy toimplement.