Skip to content

Conversation

@PROMETHIA-27
Copy link

I'm working on a project right now where I'd like to temporarily construct a dense slot map, use it for a while, then convert all my keys to indices and the slotmap into a vec to remove indirection for use. While this could be done manually with drain or other existing API, it would be much more efficient to be able to reuse the internal logic to destruct the slotmap for the inner value vec and perform get() calls and return the index instead of the value at that index. I figured someone else might want this API extension.

Also, the random changes outside of .get_dense_index() and .into_dense() are from cargo fmt automatically running. I can undo those if you'd like.

@orlp
Copy link
Owner

orlp commented Sep 30, 2022

Hey, pretty soon I'll start working on slotmap 2.0 which will demystify keys in general (making them more clearly as an index + version instead of the current agnosticism). By then I'll also make sure to add a method for the dense vector to access the values as a slice, and turn a slotmap into a pair of keys/values vecs.

But I don't think there will be another version before slotmap 2.0 that could include this PR. I'll leave it open for now though so I won't forget for 2.0.

@PROMETHIA-27
Copy link
Author

Sounds good! Is there an estimate for how long it'll be til 2.0? If not that's ok, I already have my patch in place. Just don't want to forget to update when it's ready.

@orlp
Copy link
Owner

orlp commented Sep 30, 2022

No estimate yet, sorry.

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

Successfully merging this pull request may close these issues.

2 participants