Chains a function that returns a Result to an existing Result.
If the result is Ok, the apply function is called with its value, and its returned Result is returned.
If the result is Err, it is returned unchanged.
This is similar to map, but apply also returns a Result, allowing for sequential operations.
Type Parameters
T
The original type of the successful value.
U
The new type of the successful value after chaining.
Chains a function that returns a
Result
to an existingResult
. If theresult
isOk
, theapply
function is called with its value, and its returnedResult
is returned. If theresult
isErr
, it is returned unchanged. This is similar tomap
, butapply
also returns aResult
, allowing for sequential operations.