Zero to Web in Rust – Rustlings is The Coolest Tutorial Ever!

3 min read Original article ↗

Hello, friends! I hope you’re all doing super well!

After hearing friends and many people on the Internet talk about Rust for quite a long time, I decided I would take the plunge and start learning it! I had made some short-lived attempts to learn the language before, but I didn’t stick with it. This time is different, however, for a few reasons.

For one, I’ve decided that i will document my journey in Rust on this blog. As you may have guessed, my goal is to build a web application in Rust; I will probably recreate Google Keep or something similar, as I find it to be a useful app. Unfortunately, it also runs the risk of being sunsetted by Google at any moment. It’s just something that Google has done with a lot of its products over the years. I’m not entirely sure why.

Anyway, I wanted to tell you all that Rustlings is an awesome way to pick up Rust by actually writing bits of code! The approach has been a lot better than I thought it would be, since each unit test takes just a one or two small changes to pass, so you get to write just enough code to train your fingers on how Rust code feels to write. You don’t have to worry about getting bogged down in picking out libraries or frameworks for a project, you write just enough code to get familiar with a concept, with instant feedback from the delightful Rust compiler and Rustlings test suite!

Aside from being interactive and providing a rapid feedback loop, Rustlings is made to correspond to the freely available Rust Book, also a great first-party resource from the Rust team! 😀

This first image displays a very friendly error message from Rust. I used the wrong syntax to get the element at index 1 of a tuple, so it told me exactly how to solve the error. Languages such as Python and even C++ are also adopting these sorts of helpful error messages. I can say it’s a very welcome improvement over having to Google basic bits of syntax when learning a new language, or returning to an old one after a long time.

This second image shows that each exercise automatically turns green in the side bar when a file is saved. It’s much friendlier than manually rerunning tests. Simply rerunning tests on save is a smart idea that I wish I had thought of, but it’s something that comes with the Rustlings exercises. Speaking of which, here’s the GitHub repository for those exercises.

Give Rustlings a go! You won’t regret it!

Thanks for making it to the end of this article. Be sure to subscribe, and stay turned for my next posts, since I’m still going to be doing the Rustlings exercises for a few more days. I plan to post about creating a Rusty REST API, with a blazing-fast™ UI library. I’d love to hear your thoughts about which libraries or frameworks would be best for these tasks! 🙂