Readonly
errorReadonly
valueCombines the current Result with another Result. If the current Result is Ok, returns the other Result. If the current Result is Err, returns a new Result with the same error.
The combined Result.
U The type of the value contained in the other Result.
Chains a new Result
by applying a function to the value of the current Result
.
If the current Result
is an error, the error is propagated to the new Result
.
Result
obtained by applying the function to the value of the current Result
.Throws an error with the specified message if the result is an error. Otherwise, returns the value.
The error message to throw if the result is an error.
The value if the result is not an error.
Error with the specified message if the result is an error.
Throws an error with the specified message if the result is not an error. Returns the error value if the result is an error.
The error message to throw if the result is not an error.
The error value if the result is an error.
Error with the specified message if the result is not an error.
Inspects the value of the Result using the provided predicate function. If the predicate returns true, the current Result is returned. If the predicate returns false, a new Result with the same error is returned.
The predicate function to inspect the value.
The current Result if the predicate returns true, otherwise a new Result with the same error.
Inspects the error value of the Result and returns a new Result with the same value and error if the provided predicate returns true. If the predicate returns false, a new Result is returned with the same value and a null error.
A function that takes the error value as a parameter and returns a boolean indicating whether the error should be inspected.
A new Result instance with the same value and error if the predicate returns true, otherwise a new Result with the same value and a null error.
Checks if the result is an error and satisfies the given predicate.
The predicate function to apply to the error value.
true
if the result is an error and the predicate returns true
, otherwise false
.
Checks if the result is Ok and satisfies the given predicate.
The predicate function to apply to the value.
true
if the result is Ok and the predicate returns true
, otherwise false
.
Maps the error value of the Result to a new value using the provided function. If the Result is an Err, a new Result with the mapped error value is returned. If the Result is an Ok, a new Result with the same value and a null error is returned.
Returns the value contained in the Result if it is Ok, otherwise returns the provided default value.
The default value to return if the Result is not Ok.
The value contained in the Result if it is Ok, otherwise the provided default value.
Static
errStatic
fromStatic
matchStatic
ok
Represents a result that can either hold a value of type
T
or an error of typeE
.