Amanieu / intrusive-rs

Intrusive collections for Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Would it be possible to be generic over the reference type?

llogiq opened this issue · comments

I'm looking into getting more real-world tests for compact_arena, and intrusive collections should be a good fit. However, intrusive-rs uses *const pointers internally.

Would you accept a PR that makes the structures generic over the pointer type and perhaps add a scope type so that we could use compact_arena with this?

Sure, I'd be happy to accept a PR!

This is something that I've actually wanted to do for a long time, but I've been busy with other stuff and have never actually gotten around to it.

However keep in mind this isn't as simple as it seems design-wise. You'll probably want to put the index<->pointer conversion in the Adapter trait somehow so that you only need one reference to the arena per collection, rather than per node.

Perfect!

I only see the need for an index → pointer conversion, not vice versa. Do we need both to_ptr and to_mut_ptr?

Gee, that's a gnarly macro.