Knowledge Drop: Learning Rust
Resources to kick-start your Rust journey
One of my Twitter rants made its way into ZDNet, and the thread it was in sparked some ⁇ on how to get started in Rust. Rather than thread it, I’m dropping some thoughts here, since they’re easier to export to some other platform when I eventually leave Substack.
And So It Begins
There is a hole in your mind, and just like Captain Sinclair, those seven words are about to turn your universe upside down by bringing you into the Rust fold.
I’ll likely get some heat for this (or folks will just not care), but I’m giving you the same advice I would give a person coming to R for the first time: read the fine manual. With R, the manuals do cover tons of ground, as to the manual pages in R itself, which are filled with contextual notes and examples for the foundational topics.
Rust’s manuals/books are 10x better.
I learn best through both examples, solving problems, and coding up things I’ve written in other languages in new ones.
If you are problem-solving-driven, then you will want to give rustlings a 👀. They’re fun exercises that will end up forcing to read bits of The Rust Book that you skipped over.
If you are “re-coding”-driven, you know what you have to do next, find some projects you’ve like to do in your fav language and start coding them up! Keeping the cookbook handy while doing so may be useful.
Rather than reinvent the wheel, I’ll now direct you to Camille Tjhoa’s collection of resources to help you learn Rust. I’ve tapped on ~80% of the links there and visit back to see if new ones are posted.
Your Rust Development Environment
You may be a terminal person. You may be a Sublime Text person. You may be a Vistual Studio Code person. If you’ve been coding for a while, you have development environment preferences, and I’m not one to push my religious beliefs on others.
Having said that, I would like to suggest that you check out Visual Studio Code as your Rust development environment. There’s a whole section on how to get started with Rust in VS Code, and I find it to be a very productive environment when working with Rust (and Jupyter notebooks, if I may put a plug in for that as well).
That resource talks about rust-analyzer, and you will want to get all warm and cozy with it. One core tenet of Rust is to do no harm and write safe + resilient code. Rust-analyzer will make you a better Rust programmer and also help reduce the number of times you will want to hit your head against the desk whilst using new Rust concepts/idioms.
You will also want to bring clippy and rust-fmt into the dev-environemnt fold, especially if you intend to ask for help on SO or Reddit. The Rust community is great, but they can be as frustrating as R’s mailing lists sometimes when it comes to individual pedantry. I’d suggest adding the subreddit to your RSS feeds as I find them easier to triage there before using Reddit (friends don’t let friends use Reddit directly, IMO).
Finally, I recommend using Just vs Makefiles or plain cargo to manage your Rust projects. You’ll appreciate Just’s sensible simplicity as you move on to larger projects.
Some Other Things I Wish I Knew When I Started My Rust Dive
Parse command line options with clap.
Use the reqwest ecosystem for HTTP ops.
Use the chrono ecosystem for timey-wimey things.
Use the tokio ecosystem for asynchronous programming and definitely dive into async programming, since it’s one of Rust’s stregths (despite Golang making it a bit easier to dive into).
Start logging early. You’ll thank yourself (and me!) later. There is a robust logging ecosystem throughout Rust.
Get into the habit of immediately creating a
lib.rs when you start a binary project. Read more about that here.
Get used to passing things by reference again if you’re coming from R or Python.
Hit up the GH Rust tag often. Plenty of new resources drop there, and it’s worth digging in to the back pages to find interesting nuggets.
The Changelog often showcases Rust projects, which may be useful on their own, but are also great to explore from a source code perspective.
Tristram Oaten (@0atman)’s “No Boilerplate” repo and YouTube channel have transcripts and videos on a number of Rust topics, including one on setting up the perfect Rust coding environment. This may or may not be right for you, but the videos are produced well, and you will be a better Rust programmer as you progress through them.
Aria Beingessner has some fun/detailed Rust resources on their blog.
If you’re into reverse psychology, then learn how not to learn Rust, by Denys Séguret.
If you just want to give Rust a quick go, Repl.it might be something you’d be interested in.
Despite linking to Tristam’s YT in the previous section, I did so mainly for the transcripts, as I never watch the videos, since I don’t learn that way. Tons of others do. If you’re one of them and have 120 minutes to spare, this is a great start:
These are a collection of Rust topics that make up (prett much) an entire course in Rust:
If you have other resources, I encourage you to drop them in the comments so others can discover them as well!