2 ms·
In Rust, your code would look like this: fn foo() -> Result<i32> { let result = bar()?; let result2 = baz()?; let result3 = bazz()?; } (
by steveklabnik 6y ago
In Rust, your code would look like this:
fn foo() -> Result<i32> {
let result = bar()?;
let result2 = baz()?;
let result3 = bazz()?;
}
(This wouldn't compile because you don't actually return anything in the success case, but I just kept the code the same. Additionally, I am assuming you are using some sort of crate that helps with error type mapping, because that's realistic, otherwise, it would be Result<i32, Error> where Error would be some sort of type mapping to SomeException's type.)