6 ms·
Thanks for the info. I imagine that in this care, since it seems the error is not captured, it should end producing panic. So a question mark is used when the e
by catfacts 1y ago
Thanks for the info. I imagine that in this care, since it seems the error is not captured, it should end producing panic. So a question mark is used when the expected result is of type Result or Error. Also the web page, https://doc.rust-lang.org/rust-by-example/error/result.html https://doc.rust-lang.org/rust-by-example/error/result.html, describe the result type as Ok(T) or Err(E), and indicates that is a richer version of Option.
- VGHN7XDuOXPAzol 1y agoYeah, if `main` returns an error I think it exits with an error code and prints it out, so quite similar to a panic. I think the blog post is not focussing on error handling too much, but in any case this is 'safe', just could likely be handled better in a real-world case.