Welcome to the Rust Programming Language repository! This repository is a practical space to explore, test, and understand the concepts and capabilities of Rust through the examples and projects outlined in The Rust Programming Language book.
Rust is a systems programming language that emphasizes safety, speed, and concurrency. This repository is dedicated to implementing the examples and projects from the book, enabling hands-on learning for developers at any stage of their Rust journey.
- Concept Examples: Code snippets to illustrate key Rust concepts.
- Projects: Practical applications like a number guessing game, a subset of the
grep
command, and a low-level multithreaded web server. - Error Exploration: Examples of compiler error messages and their resolutions.
- Advanced Topics: Hands-on demonstrations of closures, smart pointers, concurrency, and more.
- Chapter 1: Installation, writing a "Hello, world!" program, and an introduction to Cargo, Rust's package manager and build tool.
- Chapter 2: Build a Number Guessing Game as a first Rust project.
- Chapter 3: Common Rust features like variables, data types, and functions.
- Chapter 4: Ownership, borrowing, and lifetimes.
- Chapter 5: Structs and methods.
- Chapter 6: Enums and pattern matching.
- Chapter 12: Build a Mini-Grep Tool to search for text in files.
- Chapter 20: Create a Multithreaded Web Server.
- Chapter 10: Generics, traits, and lifetimes.
- Chapter 13: Closures and iterators.
- Chapter 15: Smart pointers.
- Chapter 16: Concurrency in Rust.
examples/
: Contains concept demonstrations and small code snippets.projects/
: Contains the full implementation of larger projects.src/
: Main workspace for trying out concepts and quick examples.
- Install Rust: Rust Installation Guide
- Set up Cargo, Rust's package manager.
git clone https://github.com/cesco345/rust-learning-repo.git
cd rust-learning-repo
Running Examples
Navigate to the relevant example or project folder and use cargo to build and run:
cd examples/chapter1
cargo run
For projects:
cd projects/number_guessing_game
cargo run
### Learning Tips
Read and Experiment: Follow along with The Rust Programming Language book, trying out the examples in this repository.
Understand Compiler Errors: Rust's compiler messages are detailed and helpful. Use them to debug and improve your code.
Use the Tools:
rustfmt for formatting code.
rust-analyzer for enhanced IDE integration.
Contribute: Found a better way to solve an example? Open a pull request or create an issue!
Resources
The Rust Programming Language (Online Book)
Rust Documentation
Rust Playground
Contributing
Feel free to contribute examples, optimizations, or insights! Fork the repository, make changes, and submit a pull request.
### License
This repository is licensed under the MIT License. See LICENSE for details.