Result
A value that represents either a successful value or an error value.
Members
error
Result.erroranyThe error value, or None when the result is successful.
value
Result.valueanyThe success value, or None when the result is an error.
expect
Result.expect(msg)Returns the success value, or fails with msg and the stored error.
Parameters
msgstringMessage to include when the result contains an error.Returns
valueanyThe success value.is_err
Result.is_err()Returns True when the result contains an error.
Returns
resultboolWhether the result contains an error.is_ok
Result.is_ok()Returns True when the result contains a success value.
Returns
resultboolWhether the result is successful.unwrap
Result.unwrap()Returns the success value, or fails if the result contains an error.
Returns
valueanyThe success value.unwrap_or
Result.unwrap_or(default)Returns the success value, or the provided default when the result contains an error.
Parameters
defaultanyFallback value to return when the result contains an error.Returns
valueanyThe success value or default value.