This article offers a list of the very few occasions when a linked list is actually the correct data structure including:
> You're doing some awesome lock-free concurrent thing.
Here's an actual example of an "awesome lock-free concurrent thing" that indeed needs linked lists, Jon Gjengset re-implementing (most of) Folly's Hazard Pointers but in Rust and he eventually checks they work correctly and have decent performance:
Unlike the "too many linked list" stuff this is not a Rust tutorial and you should not try to learn Rust by following how this is done. But if you know Rust pretty well it's a pretty interesting watch. This is definitely past the point where safe Rust is enough to get work done. Rust has no idea why hazard pointers could be OK, so Jon will be responsible for delivering Rust's fabled safety in his implementation any time he needs to write "unsafe" - or else everything catches fire. I think it might also be interesting for C++ programmers who know how Folly's Hazard Pointers work and would like to just see what Rust looks like when used on real problems rather than starting with Hello World and the Fibonacci numbers.
It's not obvious (unless you follow the author on twitter[1]) but a large portion of this has been rewritten with new content. Among other things, it now includes a section on detecting undefined behavior in unsafe blocks using Miri[2], which is incredibly neat.
This post was absolutely essential for me when it came to learning "how to think in borrow-checker". Following the errors, how to respond to different ones, what they mean, which standard library constructs you're going to use over and over, how to restructure your data to avoid ownership friction. This is the missing supplement to the Rust Book, as far as I'm concerned. I recommend it to every new rustacean I can.
I've only skimmed the first few sections but so far I'm loving what I see! I just started learning Rust and have been going through "The Rust Programming Language" book. Now I'm tempted to switch to this.
My favourite formats to learn from are the "learn while you build" types where you get a good combination of the "how" and the "why," which this seems to be doing.
I really appreciate this being shared! Thanks to the authors for writing the book and OP for bringing it to my attention here on YC <3
edit: and if anyone else has suggestions of similar resources I'd love to hear about those too :D
I've been reading Command-Line Rust[1], and I think it's nice. Each chapter has a challenge where you build a common command-line tool, like echo, cat, head, wc, etc.
Just like you, I do prefer the "learn while you build" approach. My personal experience has been that the book is a nice addition to reference-style books, such as the one you mentioned.
FWIW I would recommend finishing the book before moving onto this or other resources, even if you only skim it. There’s probably no better general overview of the language as a whole than the one you find in the book: it gives you what you need to make the most of other resources.
I also really liked Rust in Action, and then once you’ve got some experience under your belt, Rust for Rustaceans.
> You're doing some awesome lock-free concurrent thing.
Here's an actual example of an "awesome lock-free concurrent thing" that indeed needs linked lists, Jon Gjengset re-implementing (most of) Folly's Hazard Pointers but in Rust and he eventually checks they work correctly and have decent performance:
https://www.youtube.com/playlist?list=PLqbS7AVVErFgO7RUIC6lh...
Unlike the "too many linked list" stuff this is not a Rust tutorial and you should not try to learn Rust by following how this is done. But if you know Rust pretty well it's a pretty interesting watch. This is definitely past the point where safe Rust is enough to get work done. Rust has no idea why hazard pointers could be OK, so Jon will be responsible for delivering Rust's fabled safety in his implementation any time he needs to write "unsafe" - or else everything catches fire. I think it might also be interesting for C++ programmers who know how Folly's Hazard Pointers work and would like to just see what Rust looks like when used on real problems rather than starting with Hello World and the Fibonacci numbers.