comprehensive-rust
This is the Rust course used by the Android team at Google. It provides you the material to quickly teach Rust.
Top Related Projects
The Rust Programming Language
:crab: Small exercises to get you used to reading and writing Rust code!
Learn Rust with examples (Live code editor included)
All Algorithms implemented in Rust
A curated list of Rust code and resources.
A runtime for writing reliable asynchronous applications with Rust. Provides I/O, networking, scheduling, timers, ...
Quick Overview
The Google/comprehensive-rust repository is an educational resource for learning the Rust programming language. It contains a comprehensive four-day Rust course developed by the Android team at Google, covering everything from basic syntax to advanced topics like concurrency and unsafe Rust.
Pros
- Comprehensive coverage of Rust, suitable for beginners and intermediate learners
- Developed by Google's Android team, ensuring high-quality content
- Includes practical exercises and examples to reinforce learning
- Regularly updated to keep pace with Rust's evolution
Cons
- May be too intensive for casual learners or those with limited time
- Focuses primarily on Rust for systems programming, which may not be ideal for web developers
- Requires a significant time commitment to complete the full course
Getting Started
To get started with the Comprehensive Rust course:
- Visit the repository at https://github.com/google/comprehensive-rust
- Clone the repository or download the course materials
- Follow the instructions in the README to set up your Rust development environment
- Start with the "Welcome" section and progress through the course materials
- Complete the exercises and projects as you go to reinforce your learning
Note: This is not a code library, so there are no code examples or quick start instructions for implementation. The repository contains educational materials and exercises for learning Rust.
Competitor Comparisons
The Rust Programming Language
Pros of The Rust Programming Language Book
- More comprehensive coverage of Rust concepts and features
- Official resource maintained by the Rust team, ensuring accuracy and up-to-date information
- Includes exercises and projects for hands-on learning
Cons of The Rust Programming Language Book
- Less focused on practical, real-world examples compared to Comprehensive Rust
- May be overwhelming for beginners due to its extensive content
- Slower-paced learning curve, which might not suit those looking for quick, targeted knowledge
Code Comparison
The Rust Programming Language Book:
fn main() {
let x = 5;
let y = {
let x = 3;
x + 1
};
println!("The value of y is: {}", y);
}
Comprehensive Rust:
fn main() {
let mut x = 1;
x += 2;
println!("x = {x}");
let y = {
let x = x * 2;
x + 1
};
println!("x = {x}, y = {y}");
}
Both examples demonstrate block expressions and variable scoping, but Comprehensive Rust's example is more concise and shows mutable variables and arithmetic operations.
:crab: Small exercises to get you used to reading and writing Rust code!
Pros of rustlings
- Interactive, hands-on approach with exercises to solve
- Gradual progression from basic to advanced concepts
- Immediate feedback through automated tests
Cons of rustlings
- Less comprehensive coverage of Rust concepts
- Lacks in-depth explanations for some advanced topics
- May require additional resources for a complete understanding
Code Comparison
rustlings:
fn main() {
let x = 5;
println!("x has the value {}", x);
}
comprehensive-rust:
fn main() {
let x: i32 = 5;
println!("x has the value {x}");
}
Both repositories aim to teach Rust, but they take different approaches. rustlings focuses on hands-on practice through small exercises, while comprehensive-rust provides a more structured, lecture-style learning experience.
rustlings is ideal for learners who prefer an interactive, problem-solving approach. It offers immediate feedback and a sense of progression. However, it may not cover all Rust concepts as thoroughly as comprehensive-rust.
comprehensive-rust, developed by Google, offers a more in-depth exploration of Rust concepts. It includes detailed explanations and examples, making it suitable for those who prefer a comprehensive, lecture-style approach. However, it may lack the immediate hands-on practice that rustlings provides.
The code examples show slight differences in style and approach, with comprehensive-rust using more modern Rust syntax in its println! macro.
Learn Rust with examples (Live code editor included)
Pros of Rust by Example
- More comprehensive coverage of Rust features and concepts
- Interactive examples that can be run and modified directly in the browser
- Regularly updated and maintained by the official Rust team
Cons of Rust by Example
- Less structured learning path compared to Comprehensive Rust
- Lacks in-depth explanations for some advanced topics
- May be overwhelming for complete beginners due to its breadth of content
Code Comparison
Rust by Example:
fn main() {
println!("Hello, world!");
}
Comprehensive Rust:
fn main() {
println!("Hello, Rust!");
}
Both repositories provide similar basic examples, but Comprehensive Rust tends to offer more context and explanations around the code snippets.
Summary
Rust by Example offers a wide range of examples covering various Rust concepts, making it an excellent reference for developers at different skill levels. It allows for interactive learning and is maintained by the official Rust team. However, it may lack structure for beginners and doesn't always provide in-depth explanations.
Comprehensive Rust, on the other hand, provides a more structured learning path with detailed explanations, making it particularly suitable for beginners and those seeking a guided learning experience. It may not cover as many topics as Rust by Example but offers a more curated and focused approach to learning Rust.
All Algorithms implemented in Rust
Pros of The Algorithms
- Focuses on implementing various algorithms in Rust, providing practical examples
- Covers a wide range of algorithm categories (sorting, searching, data structures, etc.)
- Serves as a valuable resource for learning algorithm implementation in Rust
Cons of The Algorithms
- Less structured as a comprehensive learning resource for Rust language itself
- May not cover advanced Rust-specific features and idioms in depth
- Lacks the backing of a major tech company like Google
Code Comparison
Comprehensive Rust (Error Handling):
fn main() -> Result<(), Box<dyn Error>> {
let content = std::fs::read_to_string("file.txt")?;
println!("File content: {}", content);
Ok(())
}
The Algorithms (Binary Search):
pub fn binary_search<T: Ord>(item: &T, arr: &[T]) -> Option<usize> {
let mut left = 0;
let mut right = arr.len();
while left < right {
let mid = left + (right - left) / 2;
if &arr[mid] == item {
return Some(mid);
} else if &arr[mid] < item {
left = mid + 1;
} else {
right = mid;
}
}
None
}
A curated list of Rust code and resources.
Pros of awesome-rust
- Extensive collection of Rust resources, libraries, and tools
- Community-driven with frequent updates and contributions
- Covers a wide range of topics and use cases
Cons of awesome-rust
- Less structured learning path for beginners
- May be overwhelming due to the sheer volume of information
- Lacks in-depth explanations or tutorials for listed resources
Code comparison
Not applicable, as both repositories primarily contain documentation and resource lists rather than code samples.
Summary
comprehensive-rust is a structured Rust course developed by Google, offering a curated learning path for beginners and intermediate developers. It provides in-depth explanations and exercises to help users understand Rust concepts systematically.
awesome-rust, on the other hand, is a community-maintained list of Rust resources, libraries, and tools. It serves as a comprehensive reference for developers looking for specific solutions or exploring the Rust ecosystem.
While comprehensive-rust is better suited for those seeking a guided learning experience, awesome-rust excels as a reference for discovering and exploring the vast Rust ecosystem. The choice between the two depends on the user's learning style and goals in working with Rust.
A runtime for writing reliable asynchronous applications with Rust. Provides I/O, networking, scheduling, timers, ...
Pros of tokio
- Comprehensive asynchronous runtime for Rust, offering high-performance I/O operations
- Extensive ecosystem with additional libraries and tools for building scalable applications
- Active community and regular updates, ensuring stability and new feature additions
Cons of tokio
- Steeper learning curve, especially for developers new to asynchronous programming
- Focused solely on asynchronous runtime, not a general Rust learning resource
- May introduce complexity in simpler applications that don't require async capabilities
Code Comparison
tokio:
#[tokio::main]
async fn main() {
println!("Hello, world!");
tokio::time::sleep(Duration::from_secs(1)).await;
}
comprehensive-rust:
fn main() {
println!("Hello, world!");
std::thread::sleep(Duration::from_secs(1));
}
The tokio example demonstrates asynchronous execution, while comprehensive-rust shows a synchronous approach. This highlights tokio's focus on async programming compared to comprehensive-rust's broader Rust language coverage.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Comprehensive Rust ð¦
This repository has the source code for Comprehensive Rust ð¦, a multi-day Rust course developed by the Android team. The course covers all aspects of Rust, from basic syntax to generics and error handling. It also includes deep dives on Android, Chromium, bare-metal, and concurrency.
Read the course at https://google.github.io/comprehensive-rust/.
Course Format and Target Audience
The course is used internally at Google when teaching Rust to experienced software engineers. They typically have a background in C++ or Java.
The course is taught in a classroom setting and we hope it will be useful for others who want to teach Rust to their team. The course will be less useful for self-study since you miss out on the discussions happening in the classroom. You don't see the questions and answers and you don't see the compiler errors we trigger when going through the code samples. We hope to improve on this via speaker notes and by publishing videos.
Press
Articles and blog posts from around the web which cover Comprehensive Rust:
- 2023-09-08: Teaching Rust in 5 days. Comprehensive Rust was used as a base for a 5-day university class on Rust.
- 2023-09-21: Scaling Rust Adoption Through Training. We published a blog post with details on the development of the course.
- 2023-10-02: In Search of Rust Developers, Companies Turn to In-House Training. About how Microsoft, Google, and others are training people in Rust.
Building
The course is built using a few tools:
In addition, mdbook-linkcheck checks the internal links.
First install Rust by following the instructions on https://rustup.rs/. Then clone this repository:
git clone https://github.com/google/comprehensive-rust/
cd comprehensive-rust
Then install these tools with:
cargo install mdbook
cargo install --locked mdbook-svgbob
cargo install --locked mdbook-i18n-helpers
cargo install --locked i18n-report
cargo install --locked mdbook-linkcheck
cargo install --locked --path mdbook-exerciser
cargo install --locked --path mdbook-course
Run
mdbook test
to test all included Rust snippets. Run
mdbook serve
to start a web server with the course. You'll find the content on
http://localhost:3000. You can use mdbook build
to create a static version
of the course in the book/
directory. Note that you have to separately build
and zip exercises and add them to book/html
. To build any of the translated
versions of the course, run MDBOOK_BOOK__LANGUAGE=xx mdbook build -d book/xx
where xx
is the ISO 639 language code (e.g. da
for the Danish translation).
TRANSLATIONS.md contains further instructions.
Note On Windows, you need to enable symlinks (
git config --global core.symlinks true
) and Developer Mode.
Contact
For questions or comments, please contact Martin Geisler or start a discussion on GitHub. We would love to hear from you.
Top Related Projects
The Rust Programming Language
:crab: Small exercises to get you used to reading and writing Rust code!
Learn Rust with examples (Live code editor included)
All Algorithms implemented in Rust
A curated list of Rust code and resources.
A runtime for writing reliable asynchronous applications with Rust. Provides I/O, networking, scheduling, timers, ...
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot