October 2019
Intermediate to advanced
444 pages
10h 37m
English
Returning Result or Option will always follow a certain pattern that generates a lot of boilerplate code—especially for uncertain operations such as reading or creating files and searching for values. In particular, the pattern produces either code that uses early returns a lot (remember goto?) or nested statements, both of which produce code that is hard to reason about. Therefore, early versions of the Rust library implemented a try! macro, which has been replaced with the ? operator as a quick early return option. Let's see how that influences the code.
Read now
Unlock full access