28 Rust
Standard resources:
A full set of documentation and web-books is available at Learn Rust; the main resources in the form of books are listed below following their order of importance in the beginner learning path:
For learning and reviewing the basics of Rust I recommend the following videos; start with the first for a crash course and then take more time to repeat everything and learn in more depth with the second.
Not yet reviewed:
28.1 Beginner cheat-sheet
- Compilation and Cargo
Create hello.rs with the following and compile with rustc hello.rs:
// Comments are just like in C!
/* Multiline also work, but I don't like them!
Write something useless here!
*/
fn main() {
println!("Hello, world!");
}Create a new project with cargo new hello-cargo; enter the folder and cargo run. Alternatively create the folder manually, enter it and cargo init.
Data types
- Primitives
- Compounds
- Collections
Functions and ownership
- Definition
- Ownership
- Borrowing
- References
Variables and mutability
- Declaration
- Mutability
- Constants
- Shadowing
Control flow
- Conditionals
- Loops
Structures and enumerations
Error handling
- Results
- Options