5 small projects to understand Rust core concepts.
# | Project | Description |
---|---|---|
01 | Hello Cargo | A quick intro to Rust syntax. |
02 | Guessing Game | A hands-on introduction to the Rust language. |
03 | Minigrep | A simple version of the classic command line tool grep. |
04 | Hello | A multithreaded web server that says “hello”. |
05 | Game of Life | A zero-player game to learn how to use Rust, WebAssembly, and JavaScript together. |
Check out our collection of articles for those beginning their Rust journey. Find tips, tricks, and motivational content to keep you engaged and motivated throughout your learning process.
A quick intro to Rust syntax.
- installing Rustup, Rust for Visual Studio Code and Even Better TOML.
- setting up a project with Cargo.
- printing and formatting strings.
- handling variables.
- discovering primitive types.
- playing with strings, tuples, arrays and vectors.
- rendering conditionals.
- using loops, functions and pointer references.
- creating custom data types with structs.
- defining enums.
- grabbing args from CLI.
A hands-on introduction to the Rust language.
- handling user input with the io library.
- adding rand from crates.io as a dependency.
- generating a secret number.
- comparing the guess to the secret number.
- allowing multiple guesses with looping.
- quitting after a correct guess.
- handling invalid input.
A simple version of the classic command line tool grep.
- accepting command line arguments.
- reading a file.
- refactoring to improve modularity and error handling.
- developing the library’s functionality with Test-Driven Development (TDD).
- working with environment variables.
- writing error messages to standard error instead of standard output.
- using closures and iterators.
A multithreaded web server that says “hello”.
- listening to the TCP connection and reading the request.
- writing a response and returning HTML.
- validating the request and selectively responding.
- simulating a slow request.
- improving throughput with a thread pool.
- handling graceful shutdown.
A zero-player game to learn how to use Rust, WebAssembly, and JavaScript together.
- cloning the project template and understanding the folder structure.
- building the project with wasm-pack.
- putting it into a web page with wasm-app.
- serving locally with webpack.
- implementing the Game of Life with Rust.
- rendering to canvas directly from memory with JavaScript.
- testing the tick function and debugging.
- pausing and resuming the game.
- toggling a cell's state on click.
- optimizing performances with time profiling and benchmarking.
- shrinking .wasm size with wasm-opt and gzip.
These projects are adapted from various sources:
- Rust Crash Course by Brad Traversy (2019)
- The Rust Programming Language by Steve Klabnik and Carol Nichols (2021)
- The Rust and WebAssembly Book by The Rust and WebAssembly Working Group (2021)
If you find these projects helpful or interesting, please consider starring the repository. It's a simple gesture that helps to boost the visibility of the project and show appreciation for the effort put into creating it. Additionally, if you'd like to support my work further, you can become a sponsor. Your support is greatly appreciated. Thank you!