The Rust Programming Language, The Book
Second Edition
Section titled “Second Edition”1 - Getting Started, Installing Rust, Hello World
Section titled “1 - Getting Started, Installing Rust, Hello World”Recommendations
- Use rustfmt for code formatting
- For IDE support, see rust-analyzer
2 - Programming a Guessing Game
Section titled “2 - Programming a Guessing Game”-
By default, Rust brings in a set of items in the standard library called the prelude. It is in scope for every program.
-
For types outside the prelude, need a
use
statement to bring it in explicitly -
Result
from theio::stdin().read_line(&mut guess)
in an enumeration, also called enum. Enums have variants. ForResult
it isOk
(operation succeeded) andErr
(operation failed). Theexpect()
method is called during anErr
variant.