Odak modu
Rust does not allow you to ignore errors that may cause problems in the future with its error mechanism. This is an important element of reliability.
In Rust, there are two kinds of errors, while most language does not distinguish between two errors:
These are errors like "file not found" that don't need the program to abruptly terminate. By notifying the user of the situation, we generally aim to re-run it after fixing the problem. Rust uses a data type Result <R,T> to handle recoverable errors.
Unrecoverable errors are ones that can't be resolved by a programmer. Rust has Panic! macro that make the program stop abruptly when such an error occurs. These panics will, by default, display a failure message, unwind, clean up the stack, and exit.
To understand Rust’s error handling in more detail, you can watch this video that explain the subject in detail here:
https://www.youtube.com/watch?v=s7z_sdPBwFg
You can find detailed further information from Rust Official documentation:
https://doc.rust-lang.org/book/ch09-00-error-handling.html
Resources:
https://kerkour.com/rust-error-handling
https://www.geeksforgeeks.org/rust-recoverable-errors/
Yazılım Kariyerinde İlerlemeni Hızlandıracak Programlar
Patika+ programlarımız ile 4-8 aylık yoğun yazılım kamplarına katıl, temel bilgilerden başlayarak kapsamlı bilgiler edin, yazılım kariyerine başla!
Yorum yapabilmek için derse kayıt olmalısın!