Rust By Example

The previous examples have always been very convenient; Results interact
with other Results and Options interact with other Options.

Sometimes an Option needs to interact with a Result, or a
Result<T, Error1> needs to interact with a Result<T, Error2>. In those
cases, we want to manage our different error types in a way that makes them
composable and easy to interact with.

In the following code, two instances of unwrap generate different error
types. Vec::first returns an Option, while parse::<i32> returns a
Result<i32, ParseIntError>: