News for hackers. Stuff that matters.
Re:From Rust to TypeScript by steveklabnik on Saturday September 12, 2020 @11:55AM (#24453345)
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.)

There are no comments on this comment yet.