fn main() -> Result<T,E> {
...
x = f1()?;
y = f2()?;
z = f3()?;
...
Ok(())
}
In this example, suppose f1, f2, f3 return results with different error types.
I know that the above code cannot be correct because all the ? error types have to match that of the main function. What's the best way to deal with this without changing the structure too much?
It's worth to mention, since it isn't obvious, that ? will try to convert the error contained in a Result to the type declared in the containing function's Result using Into, and that's what no2 is.