Make invalid states unrepresentable
Let’s talk about types.1This post will be applicable to most programming languages, but it is significantly easier to apply these concepts when using languages that have more powerful, functionally-inspired, or mathematically-flavored type systems2.As you probably know, the Rust compiler can spit out some pretty high-quality error messages.error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
--> src\lib.rs:11:5
|
10 | let x = vec![];
| - help: consider changin...
Read more at geeklaunch.io