3 ms·
Ha, that trick with `Map<T, ()>` is actually really neat, and I'm happy to see that there's no qualms about its efficiency that would preclude its use in the st
by kibwen 12y ago
Ha, that trick with `Map<T, ()>` is actually really neat, and I'm happy to see that there's no qualms about its efficiency that would preclude its use in the standard library. This post has inadvertently become the most thorough documentation on zero-sized types that I know of, in addition to being the gold standard for guiding people interested in implementing data structures in Rust. :)
- Gankro 12y agoAnd I completely forgot about how they can be used to give collections "chunks" of code to run without the need for function pointers! And how you can use unboxed closures with no captures to make a zero-sized bundle of static-data. Ah well. More stuff for part-2.