Stream: general

Topic: Pin-based intrusive collections


comex (Nov 14 2019 at 01:39, on Zulip):

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.)

cormacrelf (Nov 16 2019 at 03:19, on Zulip):

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.

Last update: Dec 12 2019 at 01:40UTC