rustlings
:crab: Small exercises to get you used to reading and writing Rust code!
Top Related Projects
Exercism exercises in Rust.
This is the Rust course used by the Android team at Google. It provides you the material to quickly teach Rust.
Rust Programming Fundamentals - one course to rule them all, one course to find them...
Rust explained using easy English
Educational blog posts for Rust beginners
A curated list of Rust code and resources.
Quick Overview
Rustlings is an interactive learning project designed to help beginners learn Rust programming language through small exercises. It provides a series of tasks that gradually introduce Rust concepts, syntax, and best practices, allowing users to practice and gain hands-on experience with the language.
Pros
- Structured learning path with progressive difficulty
- Immediate feedback and hints for each exercise
- Covers a wide range of Rust concepts and features
- Can be run locally or in a web-based environment
Cons
- May not cover advanced Rust topics in depth
- Some exercises might be too challenging for absolute beginners
- Requires a certain level of familiarity with programming concepts
- Limited explanation of theoretical concepts compared to a full course
Getting Started
To get started with Rustlings:
- Install Rust: https://www.rust-lang.org/tools/install
- Clone the repository:
git clone https://github.com/rust-lang/rustlings cd rustlings
- Install Rustlings:
cargo install --force --path .
- Run Rustlings:
rustlings watch
This will start the interactive mode, where you can work through the exercises. Edit the exercise files in your preferred text editor, and Rustlings will automatically check your solutions as you save changes.
To get a hint for the current exercise:
rustlings hint
To verify all exercises:
rustlings verify
Remember to read the instructions carefully for each exercise and refer to the Rust documentation when needed. Happy learning!
Competitor Comparisons
Exercism exercises in Rust.
Pros of Exercism
- Offers a wider variety of exercises covering more Rust concepts
- Provides mentorship and community feedback on solutions
- Includes a web-based interface for easier access and submission
Cons of Exercism
- Less structured learning path compared to Rustlings
- May be overwhelming for absolute beginners due to the large number of exercises
- Requires more setup and familiarity with the Exercism platform
Code Comparison
Rustlings example:
fn main() {
let x = 5;
println!("x has the value {}", x);
}
Exercism example:
pub fn square_of_sum(n: u32) -> u32 {
(1..=n).sum::<u32>().pow(2)
}
Both repositories aim to teach Rust through practical exercises, but they differ in approach. Rustlings focuses on a step-by-step guided learning experience, ideal for beginners. It provides immediate feedback and gradually introduces Rust concepts.
Exercism, on the other hand, offers a more comprehensive set of exercises covering a broader range of topics. It's suitable for learners at various skill levels and provides community support through mentorship.
Rustlings is more tightly integrated with the official Rust documentation and follows a structured curriculum. Exercism allows for more exploration and self-paced learning, with the added benefit of receiving feedback from experienced Rust developers.
Ultimately, the choice between the two depends on the learner's preferences, prior experience, and learning style. Some may find Rustlings more approachable, while others might prefer the depth and variety offered by Exercism.
This is the Rust course used by the Android team at Google. It provides you the material to quickly teach Rust.
Pros of Comprehensive Rust
- More comprehensive coverage of Rust concepts, including advanced topics
- Structured as a complete course with slides and exercises
- Regularly updated with new content and improvements
Cons of Comprehensive Rust
- Less hands-on coding compared to Rustlings
- May be overwhelming for absolute beginners
- Requires more time commitment to complete
Code Comparison
Rustlings exercise example:
fn main() {
let x = 5;
println!("x has the value {}", x);
}
Comprehensive Rust exercise example:
fn main() {
let mut x: i32 = 1;
x = 7;
let y: i32 = 4;
println!("x is {} and y is {}", x, y);
}
Summary
Rustlings focuses on hands-on coding exercises, making it ideal for beginners who prefer learning by doing. It offers a gradual introduction to Rust concepts through small, targeted exercises.
Comprehensive Rust provides a more structured learning experience, covering a wider range of topics in greater depth. It's better suited for those who prefer a course-like approach and want to delve into advanced Rust concepts.
Both repositories are valuable resources for learning Rust, with the choice depending on individual learning preferences and goals. Rustlings is better for quick, practical exercises, while Comprehensive Rust offers a more thorough educational experience.
Rust Programming Fundamentals - one course to rule them all, one course to find them...
Pros of ultimate_rust_crash_course
- More structured, course-like approach with video content
- Covers a broader range of Rust concepts in a single package
- Includes more advanced topics like concurrency and async/await
Cons of ultimate_rust_crash_course
- Less frequently updated compared to rustlings
- Fewer exercises overall, potentially less hands-on practice
- May not align as closely with the official Rust Book
Code Comparison
rustlings exercise:
fn main() {
let x = 5;
let y = x;
println!("x = {}, y = {}", x, y);
}
ultimate_rust_crash_course example:
fn main() {
let mut x = 5;
println!("x = {}", x);
x += 1;
println!("x = {}", x);
}
Both repositories provide hands-on Rust learning experiences, but they differ in approach. rustlings offers a larger number of smaller, focused exercises that closely follow the Rust Book. It's regularly updated and maintained by the Rust team. ultimate_rust_crash_course provides a more comprehensive, course-like structure with video content, covering a wider range of topics in a single package. However, it may not be as up-to-date or offer as many individual exercises as rustlings. The choice between the two depends on personal learning preferences and goals.
Rust explained using easy English
Pros of Easy Rust
- More comprehensive text explanations, suitable for beginners
- Covers a wider range of Rust concepts
- Available in multiple languages
Cons of Easy Rust
- Less interactive than Rustlings
- Fewer hands-on coding exercises
- Not officially maintained by the Rust team
Code Comparison
Easy Rust example:
fn main() {
let my_number = 8;
println!("Hello, number {}", my_number);
}
Rustlings example:
fn main() {
let x = 5;
println!("x has the value {}", x);
}
Both repositories aim to teach Rust, but they take different approaches. Rustlings focuses on interactive exercises, while Easy Rust provides more detailed explanations. Rustlings is officially maintained by the Rust team, making it more up-to-date with the latest language features. Easy Rust offers a gentler learning curve for beginners and is available in multiple languages, making it accessible to a wider audience. However, it may not provide as much hands-on practice as Rustlings. The code examples show that both repositories cover similar basic concepts, but Rustlings tends to have more specific, targeted exercises.
Educational blog posts for Rust beginners
Pros of rust-blog
- In-depth, long-form articles covering advanced Rust topics
- Comprehensive explanations with real-world examples
- Regular updates with new content and insights
Cons of rust-blog
- Less interactive than hands-on exercises
- May be overwhelming for absolute beginners
- Lacks structured progression through Rust concepts
Code Comparison
rustlings:
fn main() {
let x = 5;
println!("x has the value {}", x);
}
rust-blog:
fn main() {
let mut x = 5;
x += 1;
println!("x has the value {}", x);
let y = {
let x = 3;
x + 1
};
println!("y has the value {}", y);
}
Summary
Rustlings offers a hands-on, interactive approach to learning Rust through exercises, making it ideal for beginners and those who prefer learning by doing. It provides immediate feedback and a structured learning path.
Rust-blog, on the other hand, offers in-depth articles and explanations, making it better suited for intermediate to advanced Rust developers looking to deepen their understanding of the language. It covers complex topics in detail but may be less engaging for those who prefer a more interactive learning style.
Both resources complement each other well, with Rustlings providing practical exercises and Rust-blog offering comprehensive explanations and advanced insights.
A curated list of Rust code and resources.
Pros of awesome-rust
- Comprehensive resource collection covering a wide range of Rust topics
- Regularly updated with community contributions
- Provides links to libraries, tools, and learning resources
Cons of awesome-rust
- Less hands-on learning compared to interactive exercises
- May be overwhelming for beginners due to the sheer amount of information
- Lacks structured progression for learning Rust concepts
Code comparison
While a direct code comparison isn't relevant for these repositories, here's an example of how they differ in content:
awesome-rust (list of resources):
## Web Programming
* Client
* [cargo-web](https://crates.io/crates/cargo-web) — A Cargo subcommand for the client-side Web
* [stdweb](https://crates.io/crates/stdweb) — A standard library for the client-side Web
rustlings (interactive exercise):
// strings1.rs
fn main() {
let answer = current_favorite_color();
println!("My current favorite color is {}", answer);
}
fn current_favorite_color() -> String {
"blue".to_string()
}
awesome-rust serves as a curated list of Rust resources, while rustlings provides hands-on coding exercises for learning Rust. awesome-rust is better for discovering tools and libraries, while rustlings offers a more structured learning experience for beginners.
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
Rustlings ð¦
Small exercises to get you used to reading and writing Rust code - Recommended in parallel to reading the official Rust book ðï¸
Visit the website for a demo, info about setup and more:
â¡ï¸ rustlings.rust-lang.org ⬠ï¸
Top Related Projects
Exercism exercises in Rust.
This is the Rust course used by the Android team at Google. It provides you the material to quickly teach Rust.
Rust Programming Fundamentals - one course to rule them all, one course to find them...
Rust explained using easy English
Educational blog posts for Rust beginners
A curated list of Rust code and resources.
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