Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
llogiq opened this issue Apr 18, 2019 · 4 comments
Open

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

llogiq opened this issue Apr 18, 2019 · 4 comments

Comments

@llogiq
Copy link

llogiq commented Apr 18, 2019

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?

@Amanieu
Copy link
Owner

Amanieu commented Apr 18, 2019

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.

@llogiq
Copy link
Author

llogiq commented Apr 19, 2019

Perfect!

@llogiq
Copy link
Author

llogiq commented Apr 21, 2019

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

@llogiq
Copy link
Author

llogiq commented Apr 27, 2019

Gee, that's a gnarly macro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants