I want to learn Rust. There are so many resources available and I am unsure which one to go for, and if there are any tips on getting started?
I am a software developer by trade
Edit: Thanks for all the great replies!
As a wise person once told the Internet, don’t worry about picking the best one. But if you really had to pick one just start with the rust book. https://doc.rust-lang.org/book/ I would suggest to just dive in with a specific need you want to solve and instead of using your language of choice just use rust and look up stuff as you go. Hands on learning is usually the best learning. The only thing you need to “learn” is how to follow the ownership/borrowing paradigm that rust brings to the table.
I’m looking at this book now and I guess I’ll keep reading, but the early parts are quite verbose and I keep waiting to get to a description of the language. Something like “Rust for C++ programmers” might be worth a shot: https://github.com/nrc/r4cppp
There are a few different things like that for Ada. There are also a few “Rust for Haskell programmers” and I might look at a few of those.
There’s also Rust for the Polyglot Programmer which seems to be a generic version of those.
https://doc.rust-lang.org/book/ this is a great starting point. Then when you got the basics, and fiddled around a bit, then you can start looking for more specialized books (like Rust Atomics and Locks https://marabos.nl/atomics/ )
IMO the best way to start in a new language is to rewrite some of your previous projects in that language.
I generally start out by rewriting a couple simple 1-3 function console apps, basic leet code stuff like; palindrome, fizzbuzz, reverse an array in place, etc, and some simple unit tests for them. Then I go ahead and rewrite some of my previous projects or uni assignments in that language.
At that point I generally have a good understanding of basics and have an idea of how to approach a new project. When I got to this point in rust I then started on threading, async, why it’s easy to return a String and an ordeal to return &str, etc.
Please, don’t ever use async Rust lol :( it’s so terrible to work with closure recapture. There’s really one way of structuring your code to keep the borrow checker happy and I haven’t yet found it in my projects lol.
Yeah I would also recommend avoiding async Rust as much as possible. There’s really only a small number of situations where you need it - WASM, embedded (Embassy), and unfortunately most of the web ecosystem forces you to use it even if it isn’t necessary for 99% of people.
Sync Rust - even multithreaded - is absolutely fantastic at protecting you from mistakes & giving an “if it compiles it works” experience. Async Rust on the other hand is full of surprising and difficult to debug footguns.
- Combine iron with moist air.
- Wait.