Thoughts

mental health break ,./'"**^^$_---
Personal notes on error handling in Rust:
* Results — like Zig's error sets — things that are an error condition but need to be recoverable / handleable — control flow issue. Has Ok / Err variant. `unwrap()` maps to a panic. .ok() maps to an optional. * Options — optionals, for when being "null" is a value / expressible data state — data issue. .ok_or can be used to provide a result. Has Some / None. `unwrap()` maps to a panic. * panics — program issue, if you will, your program is designed under the assumption that it will never happen. Visible to the end user. The ? operator can, like Zig's try, syntax sugar the "else return null" or "else return error" pattern. Importantly, this only works if the calling function return value is compatible. => https://corrode.dev/blog/rust-option-handling-best-practices/ Outstanding questions: What can you do with a result? (i.e. can you provide a default or convert into an option?) Presumably Results usually have an Error as their second type or failure type. Is that true? Similarly, can you try/catch/return an error without a Result? What is expect()?
Link 9:17 p.m. Jun 10, 2025 UTC-4