Installation
- Rust Analyzer - Your 1 stop shop for all things Rust
- Error Lens - inline error hints
- Crates - extra features for
Cargo.toml
files - CodeLLDB - C/C++ debugger with Rust support
Course, exercices, docs
- Slides / (source)
- Exercises
- Legacy slides / (source)
Useful libraries
- anyhow - application-level error handling
- thiserror - error development for libraries
- log - classical logging
- tracing - span-oriented & structured logging, suitable for concurrency
- divan - statistics-driven microbenchmarking
- serde - serialize/deserialize data to JSON and other formats
- rayon - easy data parallelism
- crossbeam - advanced concurrency primitives
- itertools - more functions for iteration
- tokio - async runtime and related libraries for Rust
Day 1
- FizzBuzz
- Narcissistic Number Check
- Rust Latin
- Rustlings (Exercices 00 to 11, Quizzes 1 and 2)
Day 2
Day 3
Day 4
Day 5
- TCP Server (improved)
Day 6
- Our Rust training slides are often best at presenting information in a very condensed form!
- Start with Rust by Example - quick snippets of code with some explanations.
- Rust Book - Brown University version with some chapters reworked, added quizzes and memory diagrams. Very long, so I suggest reading specific chapters when you want to learn more about different topics.
- Rustonomicon Still not sure about the topic and need to go deeper? Has great chapters on Rust memory management, unsafe, internal data representation, etc.
- Learning Rust With Entirely Too Many Linked Lists goes deeper into Rust memory management. Starts with
clone
, moves to reference-counted pointers, and eventually showcases the use ofunsafe
in Rust for implementing a series of data structures.
- Tour of Rust's Standard Library Traits - Super useful resource! It will help you read Rust code, understand Rust standard library code, and eventually write a more idiomatic Rust.
- Error Handling In Rust - A Deep Dive - describes Rust approach to errors and covers the use of popular error handling libraries.
- Rust API Guidelines - is a set of rules that Rust Standard Library follows, and every third-party API is expected to follow.
- Rust Design Patterns lists a set of idioms with examples of their use in Rust.
- Effective Rust teaches some useful habits when writing Rust. I especially like the conversion methods diagram for
Result
andOption
types in Item 3 - Patterns with Rust Types - a quick article showing how several Rust type system concepts work together.
- Our slides on Cargo:
- Cargo commands
- How dependency resolution works
- Cargo Workspaces - your internal projects should be workspaces 99% of the time
- Rust build times
- Cargo Workspaces
- Rustonomicon has a very good chapter on Rust FFI. It covers C-to-Rust and Rust-to-C function calls, callbacks, data representation, opaque types, accessing static / global data, and stack unwinding.
- Tokio Tutorial has a few sections covering async Rust in general.
- Async Rust Today - written as stories with each one talking about a specific problem or difficulty and offering a set of solutions.
- Actors with Tokio talks about using channels to work with resources.
- mini-redis example - a very well-commented piece of code that showcases some real-world scenarios: async data sharing, work cancellation, graceful shutdown, etc. Many libraries and web frameworks take care of these tasks for you but this example is still useful to learn from.
- Rust Atomics and Locks - at this point the best book about low-leven concurrency in general, not only in Rust. Describes things like locking, compare-and-swap, memory ordering, etc. on a hardware level, OS level and finally language level. If certain multithreading concepts make you feel lost this would be an excellent book.
- 📽 Ergonomic APIs for hard problems - Raph Levien - a Keynote talk about some aspects of great API design. Raph is heavily involved in Rust GUI scene, but his advice is very much applicable to non-GUI projects, too.
- 📽 Logan Smith has a good playlist talking about various aspects of Rust API design
- 📽 Best lifetime explanation video
- 📽 Jon Gjengset makes exploration videos about various Rust features
Crates.io website is a somewhat small web application, but it handles large amounts of traffic and covers common Server-side use-cases:
- Authenticating with third-party services
- Authorization and access control
- File uploads and downloads
- Background jobs
- Error reporting, logging, monitoring, gathering metrics
Axum, SQLx, PostgreSQL, Heroku, AWS, Fastly
- 📖 Zero To Production In Rust the book walks you through building a typical web API backend and showcases how different aspects of it can be done in Rust. A large portion of the book is available as a series of blog posts on author's blog (scroll down to ToC).
- 📖 Rust for Rustaceans is an intermediate-level book. It's very dense, contains almost no examples and instead talks about various aspects of the language in detail. Think "Rustonomicon+". Do not rush to read it right away, instead go back to it once you've done some Rust work and you feel the need to understand language fundamentals deeper.
- 📖 Asynchronous Programming in Rust book by Carl Fredrik Samson explains in detail how different portions of Async Rust work. Doesn't go into patterns of Rust async programming, unfortunately.
- Rusts Axum style magic function params example another article that showcases the power of Rust's static resolution of generics
- Rust RFC book. Every language feature is added to a language through an RFC process. Find a relevant RFC, and not only it will have explanations, but also it will link to few GitHub issue threads where people debated the RFC and its implementation.
- Ferrocene Language Specification - a WIP reference about Rust-the-language. Doesn't cover standard library yet.
- Rust Compiler Development Guide talks about compiler internals, including how certain features are implemented