Rust 101 - 7: Error handling with panic and Result
January 11, 2024 [Programming, Rust, Tech, Videos]We learnt about enums and generics last time, which means we're ready to talk about Result, which is a really nice way of handling errors in Rust, that allows you to be very explicit about what went wrong, but also with a very compact syntax using the ? operator. Before that we discuss panic!
, which essentially stops your program with an error message, and is useful for handling errors that should never happen.
Series: Language basics, More syntax, Traits and generics, Building applications, Concurrency and parallelism, Trait objects, Async, Unsafe, FFI
This section (More syntax): 5: References, 6: Structs and Enums, 7: Panic and Result, 8: Methods, 9: Vec and Box, 10: Strings, 11: Exercises A2
Links:
- Slides: Rust 101 - 7: Error handling with panic and Result slides
- Exercises: artificialworlds.net/presentations/rust-101/exercises/A2-advanced-intro/mod.html
The course materials for this series are developed by tweede golf. You can find more information at github.com/tweedegolf/101-rs and you can sponsor the work at github.com/sponsors/tweedegolf. They are released under the Creative Commons Attribution Share Alike 4.0 International license.
This series of videos is copyright 2023 Andy Balaam and the tweede golf contributors and is released under the Creative Commons Attribution Share Alike 4.0 International license.