Rocket and Rust Part I (with a side of smoke)

After leaving my last role, I had some time on my hands. Aside from the normal list of things to do around the house, I also realized I wanted to spend some time learning Rust. I have heard a ton about Rust of the last couple of years, including watching some excellent videos about some of the benefits and niceties of the language. Over the course of the next few articles, I plan on discussing my adventures in Rust, how I learned, what I read, and the project I decided to do.

First things first: why Rust? There are of course, tons of things to learn. Some of my personal reasons are:

  • Super fast: performant for IoT and low-level applications, or just to makes really scalable, efficient code!
  • Super reliable: the guard rails in Rust with the compiler time errors for unhandled errors is really really attractive, along with being required to handle all expected/possible types (particularly coming from JavaScript).
  • Null handling: okay maybe this apart of the last bullet, but the way Rust gets rid of the common implementation of null references is soooo nice. We get to run into a compile time error rather than some crazy run time error five years later when we added something unexpected.
  • WebAssembly! You can compile Rust into WebAssembly. As someone who has spent a great deal of their life building web applications, I am really excited by this, and looking forward to eventually dipping into Rust -> WebAssembly.
  • Ferris: yeah, that's right. I'm in love with Ferris the crab, Rust's mascot. Don't judge me, he's freaking adorable. Also, the idea of being "rustacean" and "oxidizing" a codebase...
Cuddly Ferris the crab, courtesy of https://rustacean.net/.

Okay, great, I decided to learn Rust. Now what? Luckily I had already started watching some interesting YouTube videos. One of my favorites is from a channel I really enjoy: No Boilerplate. Particularly his "Rust for the Impatient" video is excellent.

Next I read. Alot. I like to read, and for early learning it cannot be beat for my personal learning style. Another favorite part of Rust for me is the documentation: it is excellent. You cannot go wrong with the official Rust book in the docs: The Rust Programming Language. This is where my adventures started, with installing Rust and doing a classic "Hello World". You can find the installation guide in Chapter 1.

Immediately I ran into problems. Silly problems, but problems others might experience, so why not share my struggles. For reference, I was attempting to use a MacBook Pro, with an Intel chip running MacOS Ventura 13.4. I ran the recommended rustup command in my terminal of choice:

curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh
rustup command from Rust docs

Okay, cool, so far so good. But then I tried to run the version command, to make sure Rust was in my toolchain. Nothing. I attempted to edit my .zshrc (I'm an Oh My Zsh user) to ensure things were being exported properly to my PATH. Still no joy. I decided to try installing via Homebrew, everyone's favorite Mac package manager. Still nothing. So I untapped the keg to avoid future problems.

I finally decided to use the rubber duck in my house (thanks Nick) and explain the problem, I knew there was something silly I was not seeing. While running the version command again, I realized... I was running the following:

rust --version

The problem is... that's not the command. Rust is run via running the Rust compiler. What I meant to be doing, and what is actually in the documentation, is

rustc --version

There are not enough facepalms in the world to express the feeling I had in that moment. Why wasn't I just copying from the docs? Well... Their commands have the leading $ to indicate bash, and it was easier just to type such a short command. Unless, of course... you type it incorrectly and then spend way too long trying figure out how you messed up your installation of Rust. So yeah, learn from my mistakes. When all else fails use your rubber ducks. Fresh eyes, even if they just force you to explain what you were doing, can help diagnose problems quicker than banging your head against a problem alone!

From here, I was able to successfully implement the Hello World in the Rust book! So, let's recap: our adventure so far has consisted of reading documentation, watching some interesting videos, setting up Rust on a computer (with a bit a of struggle), and successfully writing and running our first Hello World! I think that deserves a beer...

Matchless Smoke Shop

Sometimes you buy a bottle on a whim, and this was definitely one of those times. Found at a local market in their single bottle beer selection, I saw a plain white bottle label with black lettering: Smoke Shop - Smoked Sour.

Photo of the empty and much enjoyed bottle of Smoke Shop I purchased.

This beer was seriously wild. It smelled like smoked meat, like pork shoulder. I was worried it might be sweet due to the nose, but surprise! This thing was tart! Nice sour profile, with wild smoke flavor. I plan on snatching up any further bottles I can find, and given this appears to be apart of Matchless Brewing's "Bottles & Specialty Singles" lineup, I'm not sure how long it will be around.

Apparently this beer was done as a collaboration with Skagit Valley Malting, which is super neat! It's supposed to be the first installment, so hopefully I can track down some of the others (in fact, a visit to their taproon might be in order).

The style of beer was also interesting, as I haven't had or seen often, a Lichtenhainer. I was very curious, so I did some poking around to learn more about this German style. Apparently, it has been brewed more or less without lapse for over a century. It's related to the Berliner Weisse, and considered a Weissbeer (a term which, contrary to popular belief today, does not mean "wheat beer").

I found a translation of the style being described in Die Bierbrauerei (published in 1915, by Wilhelm Rommel and Karl Fehrmann). The translation is courtesy of the BeerAdvocate author Ron Pattinson from his article about the style: "Lichtenhainer is also a pale beer brewed from lightly smoked malt, though only barley malt is used". Apparently, in the past, smoky and sour flavors were fairly common in beer (or at least they were in Germany).

Alright, I feel like I learned enough today. Onwards to Part II, where I actually do some Rust.