Replaces the successful value of an Ok result with a new value. If the result is Ok, a new Ok result with the provided value is returned. If the result is Err, it is returned unchanged.
Ok
value
Err
The original type of the successful value.
The type of the error value.
The new type of the successful value.
The result whose successful value to replace.
The new value to put into an Ok result.
A new Result with the replaced successful value, or the original Err.
Result
Replaces the successful value of an
Ok
result with a new value. If the result isOk
, a newOk
result with the providedvalue
is returned. If the result isErr
, it is returned unchanged.