For using the `?` operator, the easiest (laziest) function return type is `Result<…, Box<Error>>`.
Almost all #Rustlang errors can be converted to `std::error::Error`, so you can handle many types of errors without having to worry about converting them.
fn foo() -> Result<(), Box<Error>> {
File::create("file")?.write_all(b"hello")?;
if true {
Err("even strings are convertible to boxed errors")?;
}
Ok(())
}
Examples: https://is.gd/8yeq0z