Hacker News new | ask | show | jobs
by skippyboxedhero 1345 days ago
The stuff you mentioned are the key points, it is where Rust really diverges from other languages (also traits, enums, smart pointers).

I read those parts and started coding, and ended up coming back to later chapters (and re-reading stuff that I didn't get fully until I started coding).

Imo, it isn't possible to read a book and actually understand what Rust is like (as may be possible with a lower surface area language like Go or Lua). I am about a year in and I am still learning about how the safety features of Rust dictate the structure of your language (i.e. pure functions, not passing references around everywhere, quite anti-OOP, what std library traits to implement).

I came from Python/Java, and the first thing I did was try to code the same way (creating smart pointers everywhere). Actually coding in Rust helps you understand when these approaches aren't good.

I haven't actually read anything that really explores this aspect of Rust. When to use enums, when to use std library traits (From/Into, particularly), when to use smart pointers were also quite important for me (Jon Gjengset has a lot of interesting on this on YouTube, his book is also great).