25 ms·
Rust: Error Handling – Learning Rust V
- dumindunuwan 8y agoHi Guys, This is the fifth post I wrote about Learning Rust on Medium, https://medium.com/learning-rust https://medium.com/learning-rust. Now you can read the same content via https://learning-rust.github.io https://learning-rust.github.io as well. In this post, I tried to summarize about, - Smart Compiler - Why Compiler? - Explain Error Codes - Panicking - panic!() - unimplemented!() - unreachable!() - assert!(), assert_eq!(), assert_ne!() - debug_assert!(), debug_assert_eq!(), debug_assert_ne!() - Option and Result - Why Option and Result? - Basic usages of Option - Basic usages of Result - is_some(), is_none(), is_ok(), is_err() - ok(), err() for Result types - Unwrap and Expect - unwrap() - expect() - unwrap_err() and expect_err() for Result types - unwrap_or(), unwrap_or_default() and unwrap_or_else() - Error and None Propagation - ? Operator - try!() - Error propagation from main() - Combinators - What is a combinator? - or() and and() - or_else() - and_then() - filter() - map() and map_err() - map_or() and map_or_else() - ok_or() and ok_or_else() - as_ref() and as_mut() - Custom Error Types - Error trait - From trait > I am a Sri Lankan🇱🇰 Web Developer who works in Vietnam🇻🇳. I am not a native English speaker and I am just practicing Rust in my very little leisure time, while learning more about Golang, Devops and so much in the workplace. So, if you found any mistake or something I need to be changed, even a spelling or a grammar mistake, please let me know. ⭐ Hire me! - https://github.com/dumindu/hire-me/blob/master/resume_dumindu_madunuwan.pdf https://github.com/dumindu/hire-me/blob/master/resume_dumind... ⭐ Buy me a coffee! - https://www.buymeacoffee.com/dumindu https://www.buymeacoffee.com/dumindu ⭐ Contribute! - http://learning-rust.github.io http://learning-rust.github.io Thanks