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 ⬅️
This repository contains in my_solutions branch, my progress through the Rustlings exercises - a collection of small exercises designed to help developers learn Rust programming language concepts through hands-on practice.
Rustlings is an interactive learning tool that teaches Rust through small, focused exercises. Each exercise is designed to teach a specific concept or feature of the Rust programming language. The exercises start simple and gradually increase in complexity, covering everything from basic syntax to advanced concepts like lifetimes and smart pointers.
I've completed all 95 exercises across 23 different topics:
- Variables & Mutability - Understanding Rust's ownership model basics
- Functions - Function definitions, parameters, and return types
- Control Flow - If expressions and pattern matching
- Data Types - Primitive types, arrays, tuples, and slices
- Collections - Working with vectors and hash maps
- Ownership & Borrowing - Move semantics and reference handling
- Structs & Enums - Custom data types and pattern matching
- String Handling - String vs &str and text manipulation
- Modules - Code organization and visibility
- Error Handling - Result types and proper error propagation
- Generics & Traits - Type parameterization and shared behavior
- Lifetimes - Memory safety guarantees and reference validation
- Iterators - Functional programming patterns in Rust
- Smart Pointers - Box, Rc, Arc, and Cow for memory management
- Concurrency - Thread safety and message passing
- Macros - Code generation and metaprogramming
- Testing - Writing unit tests and test-driven development
- Clippy - Using Rust's linter for code quality
- Type Conversions - Safe casting and trait implementations
Through these exercises, I've gained:
-
Memory Safety Mastery: Deep understanding of Rust's ownership system, borrowing rules, and how they prevent common bugs like null pointer dereferences and memory leaks.
-
Functional Programming Skills: Proficiency with iterators, closures, and functional programming patterns that make Rust code expressive and efficient.
-
Concurrent Programming: Understanding of Rust's approach to thread safety through types like
Arc,Mutex, and message passing with channels. -
Type System Expertise: Ability to leverage Rust's powerful type system with generics, traits, and lifetimes to write safe and reusable code.
-
Error Handling Patterns: Mastery of Rust's
ResultandOptiontypes for robust error handling without exceptions.
Status: ✅ COMPLETED - All 95 exercises solved!
Each exercise has taught me something new about Rust's unique approach to systems programming, combining performance with safety in ways that other languages struggle to achieve.
Having completed Rustlings, I'm now ready to:
- Build real-world Rust applications
- Contribute to open-source Rust projects
- Explore advanced topics like async programming and unsafe Rust
- Apply Rust's principles to systems programming challenges
This repository represents my journey from Rust beginner to having a solid foundation in the language. The progression through these exercises has given me confidence to tackle more complex Rust projects and understand why Rust is becoming the language of choice for systems programming.