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