-
Notifications
You must be signed in to change notification settings - Fork 96
Open
Description
TLDR: I want to be able to allocate multiple entries of a slab in a single go so I can have the entries reference each other.
Imagine you want to keep a value and a reference to another slab entry inside a slab.
Slab<(SomeValue, usize)>
So your the instance of your slab might contain something along the lines of this:
// slab[0] = (MyFirstValue, 1)
// slab[1] = (MySecondValue, 0)
There's currently no way to create two referencing entries inside a slab because we can't make multiple calls to vacant_entry
.
let first_entry = slab.vacant_entry();
let second_entry = slab.vacant_entry();
// use the entry.key() from each vacant_entry to insert references to the other.
The only way for me to accomplish something like this right now is to update the entries using get_mut
with the correct keys once I've already inserted the values.
Is this too a complex a feature request for this library?
Is there another, better way to do this?
Metadata
Metadata
Assignees
Labels
No labels