Ask HN: How do you learn Rust in 2023?

32 points by estebandalelr ↗ HN
I will probably lean a lot on ChatGPT, but there has to be something better, hopefully free.

18 comments

[ 3.3 ms ] story [ 54.8 ms ] thread
Probably the same way you learned it in 2018-2022. By using it to build small projects and progressively get larger.
First read the rust book.. And write your own tiny program.
ChatGPT frequently gives out incorrect code, I suggest you start with "the Book" and then work on some projects, like any other language.
First, quickly go through all the documentation. Then start writing whatever comes to mind. And if you don't understand something, go back to the documentation. For me, that's the best way to learn.
Edited for grammar and format Read the 'Rust Book' as others suggested. Make small programs.

- Result and Option ( if let, match etc)

- understand references / mutable references

- ownership and borrowing.

- traits.

- learn generics

- Box, RC, Refcell,

- threads with Arc/ Mutexes.

- std::sync - channels(tx, rx)

- tokio (if you want to get better at an async runtime)

- take up an open source project and do it rust

Read the Rust Book. Rust is not like other languages, you need to understand the fundamentals before staring a project, otherwise you will get frustrated.
Same with C++. Even C++98/03 becomes beautiful after reading TC++PL.
(comment deleted)
I have found ChatGPT to be most useful as a way of explaining tricky code examples in Rust.

So while going through Rust by Example, I'll paste programs into ChatGPT and have a conversation with it about how specific pieces work. I've also done LeetCode problems and then asked ChatGPT for feedback about my approach.

Build something. I think making an actix-web REST API is a great place to start
Create a Rust program that writes a PPM file to stdout of a shape you want to draw.

Ask ChatGPT to give you example programs you need to implement based on part of rust you want to learn.

Have you tried freecodecamp? Idk if they do it but it’s a suggestion.