Skip to content

Journey to Rust

Posted on:July 7, 2024 at 12:00 PM

Table of Contents

Open Table of Contents

Motives

So what have I used my precious time for, after leaving work to finish school? Obviously school stuff would come first(for graduation..), but admittedly the amount of spare time I suddenly got compared to the last 2 years of work was almost overwhelming. In fact, so overwhelming that I honestly felt myself become less productive as I was having trouble managing priorities. My respect for product/project managers have definitely gone up a notch.

Anyways, that doesn’t mean I haven’t done anything at all. You see, I have a strange tendency of liking ‘hip’ tech. Any new tech that would stand out as being ‘hip’ compared to the mainstream, new databases, new programming languages, new paradigms/frameworks… you name it. I’ve read about them a lot(probably too much), but never really had the time to try them out in my own projects.

What's so hip nowadays? if you ask me..

On top of my mind,

  • Gleam
  • Nim
  • Zig
  • Mojo
  • SurrealDB
  • SpacetimeDB
  • WebGPU
  • WebAssembly
  • Deno/Bun

Some controversial ones included, I know, but my standards for being ‘hip’ also largely depends on their actual production usage.

So, I decided I should delve into one of the more relatively-mainstream-ish projects that could actually end up being useful to learn: Rust. Yes, I still think Rust is ‘hip’ and ‘cool’, because it is still rare to find competent companies using Rust where I live.

Why learn Rust?

This has been a very common question for many people upon hearing about any new programming language, and for Rust in particular, it has been answered in most sensible ways out there. I’m sure you’ve heard about the most of Rust’s strengths, so I’ll skim over them briefly here to list a few that had stood out to me the most.

That was enough for me to start learning. I hated programming on the JVM(and having to optimize performance on it in particular), I really didn’t enjoy writing in Go due to its famous ‘simplicity’, and every time I got caught by the quirky parts of Typescript + Javascript, I really wished I had a better alternative at least for my hobby projects. I also didn’t want having to actively avoid shooting myself in the foot during my hobby programming sessions as well. Or at least, be able to get out of such footguns with a reasonable amount of debugging effort.

Rust is also famous for the cult-like community that follows behind it, and I’m sure you’ve found at least some of those people on the internet, suggesting REWRITE IT IN RUST for every performance/memory concern on a project ever. Due to my weird tendency of liking ‘hip’ tech, I’ve also been interested on how Rust was able to form such a cult behind it, and perhaps join it myself. Don’t worry though, I’m not entering my Arch Linux arc yet.

How to learn Rust?

Let’s say you got sold on Rust like I did above. Now it’s time to look at the learning materials. I had been bingeing Rust-related content for a long while(probably for like a year), so I had a rough idea of what to look for. Here’s a list of resources I found useful:

And also this awesome list that someone made, which contains all sorts of learning materials including the ones above. In reality though, you’ll have to experience some of the hard parts yourself to really get into it, such as lifetimes, macros, and the infamous async rust.

How to use Rust?

Now the materials listed above are all fine and dandy to get a good grasp of Rust, but what about actually using it in a project? Although an avid Rust fan could argue that there’s no limits to whre you can use Rust, which I would actually agree with, I’ve also personally found that the more you get to use the weird/hard parts of the language, the more you get accustomed to using the language. Austin Henley has a great article on such challenging projects, and I’m currently trying to learn graphics programming in Rust in particular, starting with a basic ray tracer. In the near future I’m anticipating to learn and use wgpu and perhaps the Vulkan API to experiment with more advanced concepts, as graphics also aligns with my current hobby interests.

To use Rust as an optimal choice however would be a different story, and I’m still in the process of figuring that out. From my point of view, I would definitely try out using Rust over some other language if I were to make something like these:

And some rust-ic materials

As a final note for this post, I’d like to share some of my favorite materials on rust around the internet that I’ve found useful lately:

This post is sort of a prelude to my future posts on my experiences with Rust, because I really wish more people got to experience the joy of programming in Rust. The sense of accomplishment Rust gives you from good structured code(and when it’s good code, you know it’s good code) is quite something else, and helps me understand the ‘functional bros’ bit more. Moreover, I believe such practices carry over to other relatively ‘loose’ languages as well, helping you just become a better programmer in general. As the average senior rust dev would say,

There’s no such thing as a perfect programming language, Rust is merely a .. perfect programming language.