Rust for C++ devs

If you want to learn Rust there are a lot of great and free resources online for you. My favourite one is The Rust Programming Language book also known as "The Rust Book". It's considered the official Rust tutorial and it's one of my favourite Rust books. Before picking up Rust I had around 10 years of C++ experience. While reading the book I noticed there are a lot of conceptual similarities between the two languages and I was thinking how nice it would be to have Rust explained by using the knowledge I already had from C++. It would have helped me to build an intuition for the language and how to write more idiomatic Rust code. The Rust book is definitely good but it doesn't make any assumptions about your background. If you already know what RAII is, how computer memory is organised, what a pointer/reference is you will find some of the material there redundant. When you read about something you already know you ask yourself "Is this the same as in C++ or there is a catch?" In this post I'll try to help you build intuition about how Rust works and how idiomatic Rust code looks like by sharing code samples, providing brief explanations and pointing you to the corresponding chapters from the Rust book to get the full picture. Where possible I'll make parallels with C++ and point out the differences and similarities between the two. I hope it will make your learning process a bit faster and a bit more comfortable.

Posts from this series:

Part 1: Basic syntax

Part 2: References, Structs and Traits

Part 3: Ownership and Borrowing

Comments

Comments powered by Disqus