Ask HN: Resources for Learning Idiomatic Rust?
I have more or less learned Rust from nostarch's book (which took about a month). However, I am far from being proficient with the language, not because I'm new to programming but because Rust is quite different than other languages I know. Is there a book or resources online that teach how to use the language effectively, such as patterns and best practices or even a cook book with examples?
10 comments
[ 0.23 ms ] story [ 33.4 ms ] threadI think overall you are at the part where Rust's documentation is at its weakest. Several people are working on more things here, but really, the basic advice I'd give you is to read and write a bunch of Rust code. The more you read, the more you'll absorb stuff like this. The more you write, the more things you'll need to figure out how to do, which will involve you looking at existing solutions, which will lead you to figure it out.
I wish I just had a second book to point you at, but alas, that doesn't really exist right now.
To be honest there were some sections that I glossed over that I should probably go back and annotate. I have to agree that finding some good github projects that are well documented to analyze would be a good start, I only wish programmers put more effort into commenting and documenting their code, ha.
You should check out projects by burntsushi, alex crichton, and david tolnay. They may use advanced or complicated features that you won't need to use in most Rust code, but they all write projects that are some of my favorite in Rust. And they generally do a good job of documenting things as well. I've ordered them in a totally subjective and probably wrong "least to most likely to find magic when reading their code" order. They're all great folks and write great projects though.
Thanks. That's an amazing superlative to have. :-) Hehe.
I found some complementary resources like the following: https://blog.burntsushi.net/rust-error-handling/
https://fasterthanli.me/ has a lot of very good Rust posts in varying levels
There are also some resources that are still incomplete, like the async book (https://rust-lang.github.io/async-book/) and Rust patterns (https://rust-unofficial.github.io/patterns/)
And there are youtube channels like: https://www.youtube.com/c/JonGjengset - He has videos about super advanced stuff (like implement a concurrent hash map), and the Crust of Rust which is more suitable for beginners Another one I like a lot is Ryan Levick (https://www.youtube.com/channel/UCpeX4D-ArTrsqvhLapAHprQ)
Then there are two books by Gankra
- The Rustonomicon [1]
- Learn Rust With Entirely Too Many Linked Lists [2]
Also there are three early access books on Manning
- Rust in Action [3]
- Rust Servers, Services, and Apps [4]
- Refactoring to Rust [5]
Lastly, if you're into security you may also like Black Hat Rust [6], also early access.
[0] https://www.youtube.com/c/JonGjengset/videos
[1] https://doc.rust-lang.org/nightly/nomicon/
[2] https://rust-unofficial.github.io/too-many-lists/
[3] https://www.manning.com/books/rust-in-action
[4] https://www.manning.com/books/rust-servers-services-and-apps
[5] https://www.manning.com/books/refactoring-to-rust
[6] https://academy.kerkour.com/black-hat-rust
Edit: formatting
That being said, I have found the Rust track on exercism.io the best way for me to become more proficient with the language. It is great working through a challenge, getting mentor feedback, and also seeing how others solved the same problem.
https://exercism.io/about