Learning Rust
The following is a list of resources for learning Rust as well as tips and tricks for learning the language faster.
Warning
Rust is not C or C++ so the way your accustomed to do things in those languages might not work in Rust. The best way to learn Rust is to embrace its best practices and see where that takes you.
The generally recommended path is to start by reading the books, and doing small coding exercises until the rules around borrow checking become intuitive. Once this happens, then you can expand to more real world projects. If you find yourself struggling hard with the borrow checker, seek help. It very well could be that you're trying to solve your problem in a way that goes against how Rust wants you to work.
Books
The two best book resources are:
- The Rust Programming Language a.k.a “The Book” by Steve Klabnik and Carol Nichols: available free online (https://doc.rust-lang.org/stable/book/) or for purchase (https://www.amazon.com/Rust-Programming-Language-Steve-Klabnik/dp/1593278284/ref=sr_1_1_sspa?crid=2TOK62OK5B2NP&keywords=the+rust+programming+language+book&qid=1551692164&s=gateway&sprefix=the+rust+progr%2Caps%2C-1&sr=8-1-spons&psc=1)
- Programming Rust by Jim Blandy and Jason Orendorff: https://www.amazon.com/Programming-Rust-Fast-Systems-Development/dp/1491927283/ref=sr_1_1?crid=12NIR3DQZRTUG&keywords=programming+rust&qid=1551692214&s=gateway&sprefix=programming+rust%2Caps%2C213&sr=8-1
Rust is a particular language that works best when you work with how it wants you to do things. Therefore, in general, most people find it preferable to read the books (at least the first halves) before trying to build anything complex in Rust.
Online Resources
- Rust by Example: Go through Rust with code exercises (https://doc.rust-lang.org/rust-by-example/)
- Rustlings: Similar to Rust by Example but in a console (https://github.com/rust-lang/rustlings)
- Rust for C++ Devs: https://github.com/nrc/r4cppp
- For those who need linked lists in their lives: http://cglab.ca/~abeinges/blah/too-many-lists/book/
- The std lib docs are very accessible and link directly to the source code: https://doc.rust-lang.org/std/index.html
- Once you have a solid grasp of the above, exploring the world of unsafe Rust will solidify your knowledge of safe Rust even more: https://doc.rust-lang.org/nomicon/index.html
- Learn Rust by implementing a HashMap: https://www.youtube.com/watch?v=DWNyZXUC1u4
Specialized Topics:
- Error Handling in Rust: Rust has an error handling mechanism that may be unfamiliar to you if you have a C/C++/C# background. Andrew Gallant’s blog post on the subject is a great overview: https://blog.burntsushi.net/rust-error-handling/
- Web Assembly: Rust has a great Web Assembly story. Learn more here: https://rustwasm.github.io/book/
- Embedded Programming: Rust allows you to replace C in your embedded work flows. https://docs.rust-embedded.org/book/
Libraries to Know
- Tokio - async programming engine: https://github.com/tokio-rs/tokio
- Serde - Serialization/Deserialization library: https://github.com/serde-rs/serde
- Bitflags - Structs that are just a series of bits: https://github.com/bitflags/bitflags
- Rand - random number generation: https://github.com/rust-random/rand
- Regex - regular expressions: https://github.com/rust-lang/regex
- winapi - bindings for windows APIs https://github.com/retep998/winapi-rs
Note: If your background is in C/C++ you might be tempted to implement a doubly-linked list in Rust. Rust’s strict ownership rules make implementing a doubly-linked list (where each node has multiple owners) difficult.
If you have any questions or want to know what the best way to get started in a specific area of Rust, please let us know. We’re more than happy to help set you on the right path of learning.
Omg, many thanks