ResultChain<T, E> extension
Chaining and extraction on Result.
An extension rather than members of Result, so the types come from the
static type at the call site. As members they were checked against the
type a value was built with, and an Ok<int, NotFound> held in a
Result<int, AppError> threw a TypeError when chained with a step that
fails with another AppError.
- on
-
- Result<
T, E>
- Result<
Methods
-
andThen<
R> (Result< R, E> next(T value)) → Result<R, E> -
Available on Result<
Chains another result-producing operation when this result is successful.T, E> , provided by the ResultChain extension -
orElse<
F> (Result< T, F> next(E error)) → Result<T, F> -
Available on Result<
Chains another result-producing operation when this result failed.T, E> , provided by the ResultChain extension -
unwrapOr(
T fallback) → T -
Available on Result<
Returns the successful value, orT, E> , provided by the ResultChain extensionfallbackwhen this result failed. -
unwrapOrElse(
T fallback(E error)) → T -
Available on Result<
Returns the successful value, or computes one from the error.T, E> , provided by the ResultChain extension