-
Book Overview & Buying
-
Table Of Contents
Design Patterns and Best Practices in Rust
By :
This chapter focuses on how Rust adapts well-established programming concepts for systems programming. The Result and Option types come from functional programming languages such as Meta Language, or ML (1973), and Haskell (1990). Expression-oriented programming with blocks has roots in languages such as Lisp (1958) and Scheme (1975). Resource acquisition is initialization (RAII) originated in C++ in the 1980s.
You may be expecting me to say that the reason these patterns are so valuable for us is the way Rust enables and enhances them, and that's true! Result and Option come from previous languages, but Rust makes them feel magical. Block expressions are ancient by programming standards, but they fit very naturally into Rust code to make it cleaner and more expressive. RAII has been around for quite some time, but the way that pattern interacts with Rust makes it integral to resource management with ironclad guarantees...