The Pin docs mention the ability to use Pin to implement safe intrusive collections: https://doc.rust-lang.org/nightly/std/pin/index.html#example-intrusive-doubly-linked-list
Anyone know if there's a crate on crates.io that actually implements and exposes this? (
futures-intrusive implements it but as a private primitive behind higher-level APIs.)
Not that I know of. Intrusive-collections doesn’t seem like it would benefit from the pattern — it envisages collections owning the elements, multiple collections working if you use Rc pointers, and if anything elements outliving collections rather than being dropped first (‘scoped collections’). It also doesn’t allow mutable access to fields on your elements. But AFAICT, a linked list using Pin would be feasible to do yourself every time you wanted one. It doesn’t sound too difficult.