3 min read0 views

How I'm Learning Rust

It's 2024, I've been seeing a lot of Rust-based projects for the JS ecosystem lately like the bundlers: Farm, RsPack, SWC, Rolldown. And even more like Biome and LightningCSS.

Diving into the Rust ecosystem, I've also seen some quite interesting frameworks here like: RsPC (A Rust framework like tRPC, which I really like in the JS ecosystem) and also Tauri (A framework for building cross-platform desktop applications with Rust). Those two are probably my priority for learning Rust.

More than that, I really want to have a compiled language under my belt to write more performant code, not just be a JS soyboy.

Anyway, here's how I'm learning Rust:

📕 Books

  • Rust Book - Teaches Getting Started to Advanced Rust.
  • Rustlings - Small exercises that can complement the Rust Book.
  • Rust By Example - A collection of runnable examples that illustrate various Rust concepts and standard libraries.

The Rust Book is actually one of the best bibles for a language I've ever read. It's comprehensive from installation of the toolchain related to the language and to pretty much everything else about the language. I actually understood Cargo here and the Rust Compiler.

I'll be using Rustlings just for exercises.

I'll also be using Rust By Example for easily seeing actual code whenever I need to (no deep theory), which is super useful when already coding and you forget some specifics about the syntax.

🦀 Projects, not tutorials.

For every new language I'm learning, I always create some sort of <language>-practice repo on GitHub. I really recommend this!

That's why I have my Rust Practice repo on GitHub.

On that repository, you'll be able to find a list of projects I'm learning Rust with, in increasing order of difficulty. It mostly follows the sequence from the Rust Book:

  • Hello World - This taught me about the rust compiler. (kinda like learning what node main.js does)
  • Hello Cargo - This taught me about Cargo. (kinda like learning npm init does)
  • Guessing Game - I feel like this teaches you so much about the language, and isn't too difficult! Definitely do it for any new language you learn.
  • Salary Estimator - I tried recreating CLIs with unique keyboard interactions (similar to npm create astro). It's super enlightening.
  • ... and more! Go check it out!

🤓 How it's going so far...

So far, it's been pretty satisfying and I could actually write Rust without referencing the book too much. Which is kind of insane to think that I couldn't even read Rust before (The syntax and tokens in Rust look overly complicated and unlike any language I've tried).

This is actually just the second time I'm doing this method of learning a language. I initially did this with Go. But it certainly feels more organized this time round.

I feel like the only way to really learn a new programming language is to build. No book, video tutorial, or waiting on some weird epiphany can shortcut the long hours of just pulling your hairs over a problem. Hoping in a few months, I already have a ton of projects written in Rust--and I'm also excited to see how good I'll be at it in a few months.

It's kind of insane to think others are literally building Ray Tracers for their first projects in Rust. But I'm not built like that lol.

🥳 Hope this inspires you to learn Rust too! Feel free to recreate this same method that I'm doing. Good luck!