Getting started with Rust
Learning and teaching Rust has been a big part of me in the last couple of years. Interest in the Rust programming language has brought me to found the Rust Linz meetup with Rainer Stropek, to teach Rust at the local university, and to do a ton of workshops on the topic. It’s a lot of fun! It has introduced me to one of the most welcoming communities. And I love seeing Rust code getting in production and keeping all the promises it gives us. Folks who I’m in contact with through various channels ask me how to best get started with Rust. This article tries to give you an overview.
The big problem with an article like this is that there is no definitive answer. Everybody learns differently. Some watch videos, some read books, others need tutorials. So instead of giving you a learning path, let me give you an overview of great resources that might help you get started!
Tutorials #
I learned a lot about Rust by using Exercism. It’s an interactive platform that guides you through various Rust concepts through actual examples. You solve arbitrary programming tasks – Programming 101 if you will – that you might already know how to solve in other languages, so you can focus on implementing and learning the language rather than on finding the right algorithm. Tests give you feedback on your solution, and you’re able to consult a trainer or the community for other solutions. Seeing the solutions by others also helps improve yours and maybe find new techniques along the way.
Books #
How many books are there on Rust? The answer is: yes. No seriously, every major tech publisher has multiple different takes on Rust. The Rust community and working groups publish online books on certain topics like the Rustonomicon for unsafe Rust, the book on async Rust, or the unofficial book on Rust design patterns. Sharing info on Rust is a common thing in the community, which is great!
There are a couple of introductory books that are floating around, aimed for different styles of learning and released by different publishers.
- The Rust Programming Language – a.k.a “The book”. This is a fantastic and holistic introduction to the programming language and is available for free on the Rust website. It’s also possible to install a local HTML copy via rustup. It’s what you expect from a book that tries to give you all the info of what’s in store with the programming language itself, and it’s huge. The authors still managed to contain a narrative and lead you from chapter to chapter without overwhelming you. A couple of smaller projects help you get your feet wet with actual code. It’s hard not to recommend the book. Also, the physical copy is beautifully typeset.
- Programming Rust published by O’Reilly. I tend to find O’Reilly introductory books a little hard to navigate, but Programming Rust is delightfully different: It’s as huge as the book, but I feel chapters are much more self-contained, making this a nice book if you want to have a guide from the very start, but also a book that you can use as a reference. I learned a ton about Futures and async by just picking out the respective chapter. Being an author myself, I think this is a remarkable achievement to create a book that can be accessed on so many levels!
- Rust in Action published by Manning. Tim’s book has an entirely different take on how to learn Rust. It’s a lot more project-focused, which means that you finish each chapter with a complete Rust program. This makes it a lot more active than other books. Plus, all projects revolve around systems programming, which is arguably one of the most important use-cases for Rust, but might be unfamiliar with a lot of developers. So, with Rust in Action you hit two birds with one stone: Actively learning Rust by coding, and developing a sense for systems programming. Especially the latter is super helpful if you find yourself in situations where you need to dig a little deeper on how things work in Rust. Highly recommended!
There are so much more. Please look out for Rust books that might be tailored to a specific use-case that’s just up your alley, like Herbert’s “Hands-on Rust” that teaches through game development, or Luca’s “Zero to Production in Rust” that helps you deploy web APIs written in Rust.
Videos #
One of my most favorite videos is “Hack without fear” by Niko Matsakis. It gives you a really good overview of some of the most important topics and concepts without overwhelming you with syntax. Here, you learn ownership. You get the most important principles presented in the most digestible way.
I usually don’t do video courses, but I found Udemy’s Ultimate Rust Crash Course by Nathan Stocks valuable and approachable. Again for the same reasons: Introducing you to concepts and the language fundamentals in a very focussed way, without overwhelming you too much. The course runs for less than 3 hours, which is super short given how vast the programming language is. Still, you manage to gather a lot of information and see some actual examples!
I also invite you to watch the entirety of recordings for the Rust Linz meetup. We started 1.5 years ago with a special focus on newcomers, so you find some great introductory talks on Cargo, iterators, traits, debugging, paired with a lot of applied use-cases. One of our most-watched videos is “Learning how to learn Rust” by Tim McNamara (again!), which you might enjoy as well!
Improving #
While being influenced a lot by its precursors, Rust works differently than many other programming languages. Especially if you come from an OOP background and did mostly Java or C# in the past, you might find it hard to adapt to new patterns and leave out old ones that you acquired over the years. I could write at length on things that might not be useful while learning Rust, but I’d rather refer to the following resources
- Denys’ excellent piece on “How not to learn Rust” break with acquired habits and gives you hints and leads on things that might be different in Rust as compared to other languages
- My own Idiomatic Rust workshop tries to shed light on special patterns and techniques that might be new to you.
- Pascal’s work on Elegant APIs in Rust is a landmark guide in writing good Rust code. You can learn a ton from this article.
And that’s how I would get started learning Rust. I’d like to improve and extend the list over time. If you found a great resource that you think should be on this list, let me know!