LPGhatguy / thunderdome

Arena type inspired by generational-arena
Apache License 2.0
197 stars 15 forks source link

Add Arena::invalidate and test. #6

Closed sdleffler closed 3 years ago

sdleffler commented 3 years ago

This PR adds a method Arena::invalidate(&mut self, index: Index) -> Option<Index> allowing the user to purposefully invalidate an Index and receive a new index, roughly equivalent to remove followed by insert of the same element but without all the free pointer mess. It also adds methods Index::to_bits/Index::from_bits to make it easier to pass indices outside of Rust; specifically, extra conveniently, thunderdome indices will nicely fit inside a Lua light userdata...

LPGhatguy commented 3 years ago

This PR looks great! Can you also add two entries to CHANGELOG.md under the unreleased changes section? That makes it easier to throw this into a release whenever.

sdleffler commented 3 years ago

Sure! How's this look?

LPGhatguy commented 3 years ago

Thank you!