Learning Rust: OMG WTF RS – resources to help you get started with Rust

I'm an embedded C/C++ developer who joined Ferrous and made the switch to Rust this spring. One thing that continues to amaze me on this journey is the quality and friendliness of Rust tools and learning resources.

Still, when you're just starting out, it can be hard to know where to even start looking for these resources. Therefore, I'd like to share some of my bookmarks that have been and still are a huge help to me.

Rust Book appendix 02: Operators

screenshot of appendix 02

When you're spleunking through other people's Rust code as a beginner, you may be confronted with operators that are not self-explanatory and hard to google. This is where the Rust Book appendix 02: Operators comes in handy: it contains a helpful list of explanations for things like the lifetime specifier ' or the “And the rest” pattern binding ...

explaine.rs

screenshot of jrvidal.github.io/explaine.rs

If you encounter a chunk of Rust code that is hard to make sense of, you can copy it into explaine.rs and it'll explain it to you. This tool has been a godsend when I started exploring other people's code bases.

Compiler Explorer

screenshot of rust.godbolt.org

Especially if you're coming from a systems background and are anxious what rustc will make of your code, compiler explorer lets you explore the assembly it produces. It supports different versions of rustc (among many other languages).

Books: lightweight, helpful and free

screenshot of the rust-lang mdbook

It took me a while to grasp that when a rustacean refers to a book, they do not mean the big published exists-on-dead-trees type.

In the Rust world, books are an mdbook-generated set of chapters explaining things like a library, or a concept, or the entire language. They tend to be concise, helpful and less daunting.

You've probably already come across The Rust Programming Language book at doc.rust-lang.org/book*, but there are many more! Some examples are:

* of which a printed version actually does exist

Rust-Analyzer

screenshot of code annotated by rust-analyzer

Rust-Analyzer is an editor plugin that provides you with all kinds of helpful information about your code without getting in the way (you basically get to experience type inference in action!). It best works with VSCode, but also supports Vim, Emacs and SublimeText among others.

Rust-Analyzer is the reason I don't hate Rusts let thing = mysteriousGenerator(); syntax that lets you omit the type nearly as much as I thought I would.

It also provides you with a helpful little ▶ Run button for your tests and main() functions that you can even use to run embedded firmware and tests on your target device.

Their twitter media feed gives you a peek into many more cool things Rust-Analyzer can do.

Learning With Projects and Peers

Learning a new language that introduces many new paradigms on your own can get frustrating. Luckily, there are several initiatives for guided or cooperative learning.

Rustbridge

Rustbridge specifically aims to teach underrepresented people Rust. They currently have a chapter in Berlin, but you can also found and host your own.

Knurling-Sessions

Knurling-Sessions provides you with quarterly embedded projects accompanied by screencasts and tutorials. Using generally available hardware, you'll explore specific projects, building full systems and components using microcontrollers, sensors, and actuators. The first run will start in October.

Ferrous Systems trainings

We've open sourced the materials for all of our courses, so you can spelunk through the exercises of our embedded training and general Rust teaching material. If you'd like to learn in a group, led by our trainers whom you can ask all your questions, check out our online courses!

Awesome Rust Mentors and Rust Experts

It is immensely helpful to have a mentor to ask those "Hey, how do I…?" questions that the above tools can't answer. I've found that I had to fundamentally re-think the way I solve problems, and sometimes I got stuck transforming my old habits into idiomatic Rust. I got lucky there, because my colleagues at Ferrous helped me with code reviews and detailed explanations of things I found puzzling. (Side note: This is also a Ferrous service you can book, it's called Rust Experts)

If you don't have a Rustacean at hand, Awesome Rust Mentors may just be able to introduce you to one (or, if you are a Rustacean who would like to help others, connect you to a mentee)!

Stay tuned …

In the next part of this series, we will talk about why hands-on training is so important.

In the meantime, please consider signing up for our training newsletter or enlisting us as trainers for your team.