3 ms·
That's exactly why I love Rust. Of course, if you don't want to write good Rust or are lazy, you can "reimplement" null with the Option enum and unwrap() it eve
by rpigab 4y ago
That's exactly why I love Rust.
Of course, if you don't want to write good Rust or are lazy, you can "reimplement" null with the Option enum and unwrap() it everytime, so your code panics everytime, or do the same by returning errors without thinking about if your code should move on. You still have to think about it, but at least you're not doing null checks AND Option.NONE checks, which is extremely tedious in Java, for instance.
So, for a quick script or rapid prototyping, just unwrap/panic if you don't care about the result, like in a short code contest, and for any other use, refrain from using these, match all possibilities, implement a strongly typed Error management.