So you wanna learn Rust?

Saturday, 20 Apr 2024
techso-you-wanna-learn-rust

Taking the plunge

So perhaps you've heard of Rust? Maybe you've seen all the memes and you've now decided you can no longer sit on the fence and you want to jump right in! This is an excellent choice and one that I suspect you will look back on and ask yourself "why didn't I do this sooner!"

While the Rust memes are light hearted humour poke at the Rust community, as with all comedy there are sometimes a few grains of truth to them. The meme "Rust Evangelism Strike Force" for example does have some truth to it. Yes some Rust users can come across overly excited and shouting about Rust at every opportunity, keep in mind that's a small minority of Rustaceans and most of us are nothing like that!

I can't personally control the behaviour of others, however after people who learn Rust and find it works really really well for them, it's natural to want to share that excitement to others (some just go a little overboard with it).

Ok enough talking, if you want to learn Rust these are the 3 concrete steps you can take to start your journey into the amazing world of Rust:

Step 1 Get the book

Everyone has a different approach and way of learning (not to mention if they're a normal or fast learner). I would highly recommend that instead of jumping straight into the deep end to take a more structured approach.

One of the mistakes I see sometimes is that learners eager to try something new go "running before learning to walk". Rust does have a bit of a learning curve and skipping the theory and basics may end up causing a lot of headaches down the line.

So what book should you read? There are now a lot of options and choices, but in all honesty the one I would always recommend when starting out is often referred to as the "Rust Bible".

The book: "The Rust Programming Language" by Steve Klabnik and Carol Nichols is in my view still the best introduction into Rust. The book is structured well and contains practical code examples as they guide the reader through the fundamentals of Rust e.g Ownership, borrowing, and lifecycles. It's fairly rounded as it also covers generics/traits, pattern matching as well as testing.

The book doesn't just talk all theory and concepts and boring syntax descriptions, it actually pairs it nicely to real Rust code snippets and examples, which I believe massively help when starting to learn and get comfortable with Rust.

Grab "The Rust Programming Language" book on Amazon

Step 2 Install Rust

So you've got the book, fantastic you're now two thirds of the way to glory! Now it's time to grab Rust, and honestly it's super simple, if you have Linux or Mac then it's literally a one line command away:

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

If you don't want to use the CLI there are other ways to get Rust installed onto your machine:

Other ways to install Rust

Step 3 Start building Stuff

Amazing! you have read the book and have installed Rust. Hopefully you now have the basics and theory all ticked off, however to truly get productive and fluent the theory has to go hand in hand with the practical stuff and in order to gain the practical experience this can only really be done by building stuff. If you're unsure what to build you can head over to "Exercism" which is a free and a "not for profit" organisation and they have a bunch of great Rust exercises you can try your hand at:

Free Rust Coding Exercises on Exercism

Conclusion:

Learning Rust in my view is a great long term investment, while it may not be the easiest hill to climb. You can reduce that burden by taking a more structured approach that will go a long way to help you ease into your journey. I wish you all the best, and I can't wait to see what you build with Rust!

Please share how you got on? How did you find the book? And did you find the exercises helpful?

If you enjoyed and found this post helpful, buy me a coffee :)