r/learnrust • • 17d ago

best way to learn rust?

hi. i develop using cpp. i want to learn rust to see what the hype is all about and build some systems (core) in rust. what's the best way to learn rust with my bg in cpp? should i learn it from scratch or learn by mapping it to cpp?

20 Upvotes

13 comments sorted by

7

u/Any_Commercial_6764 17d ago edited 16d ago

Skim/read the Rust book: https://doc.rust-lang.org/book/

As you go along you can try and look at some simple programs on github or tutorials to get a feel for the syntax.

Rust is different than cpp, I’d treat them as such. Every language has high level constructs such as conditionals and iteration; map programming languages at that level rather than trying to connect cpp to everything. Rust also is just pretty unique.

Do a simple project or two and you’ll have most of the core syntax down.

2

u/autisticpig 17d ago

Rustlings is the best thing to play with as you work through the book. Then go off and do your own thing

1

u/Same_Preparation9048 15d ago

That's a solid starting point. For Rust specifically, the official book is often recommended for getting a grasp on the core concepts before diving into external projects. It covers the memory safety aspects quite thoroughly, which can be a bit of a hurdle initially.

1

u/burntoutdev8291 14d ago

Microsoft has a rust training guide that teaches people the transition from another language. It's something i would've liked in addition to the rust book

3

u/DavidXkL 17d ago

Start with the rust book.

Then do some practice with Rustlings, Advent of Code.

Then rewrite your old projects in Rust

2

u/sunilmourya 17d ago

This is good repo, if you are coming from C++ background https://github.com/microsoft/RustTraining

1

u/alpha1beta 16d ago

I'm learning Rust, but I've taught SQL, PHP and general website building. I always encourage people to build what they know - it might be an IMDB clone, or a blogging platform, or a Twitter clone, or a video game library app. Doesn't matter. Build something you understand and love, so when it comes time to structure your data and write code, especially that around inputs, output and database code, you'll understand your goal.

Building a airline reservation system, or any other textbook examples isn't gonna resonate with everyone.

1

u/KGVTEJA 6d ago

there are so many books what books should i follow in order ?

0

u/just-kenny 17d ago

I did peijexts, and then I joined a startup thst used it in production exclusively....really taught me a lot