Skip to content

solygambas/rust-projects

Repository files navigation

Rust Projects

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.

Get Inspired

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.

1) Hello Cargo

A quick intro to Rust syntax.

See 01-hello-cargo folder

Features

  • 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.

2) Guessing Game

A hands-on introduction to the Rust language.

See 02-guessing-game folder

Features

  • 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.

3) Minigrep

A simple version of the classic command line tool grep.

See 03-minigrep folder

Features

  • 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.

4) Hello

A multithreaded web server that says “hello”.

See 04-hello folder

Features

  • 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.

5) Game of Life

A zero-player game to learn how to use Rust, WebAssembly, and JavaScript together.

See 05-game-of-life folder

Features

  • 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.

Acknowledgments

These projects are adapted from various sources:

Show Your Support

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!

About

5 small projects to understand Rust core concepts.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published