Result
1 type4 functionsWorking with Results, the [Ok(a) | Err(e)] variant that fallible functions
return. The ? operator unwraps an Ok and returns an Err early; these
functions transform one without leaving the function.
At a glance
Types
Result
Shorthand for [Ok(a) | Err(e)].
Functions
map
f applied to an Ok's value; an Err passes through unchanged.
mapErr
f applied to an Err's error; an Ok passes through unchanged.
andThen
f applied to an Ok's value, whose own Result is the answer; an Err
passes through unchanged. Chains steps that can each fail.
withDefault
An Ok's value, or d for an Err.