Skip to content

Add custom allocator support (allocator-api2)#141

Open
shitohana wants to merge 7 commits intopetgraph:masterfrom
shitohana:master
Open

Add custom allocator support (allocator-api2)#141
shitohana wants to merge 7 commits intopetgraph:masterfrom
shitohana:master

Conversation

@shitohana
Copy link
Copy Markdown

This PR makes FixedBitSet generic over an allocator to support custom memory strategies. It uses allocator-api2 for stable support and includes a zero-cost polyfill to keep the code clean when the feature is disabled.

Key Changes:

  • Generic FixedBitSet: Now supports custom allocators but defaults to Global to avoid breaking changes.
  • Stable Support: Added the allocator-api2 feature for users who need custom allocation on stable Rust.
  • Safer Memory Logic: Updated grow_inner and vec_into_parts to safely handle allocator ownership during resizing and deallocation.
  • Clean API: Added internal traits and types so the logic remains consistent whether the feature is on or off.

Everything remains backward compatible for standard users while giving more flexibility to those in specialized environments.

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.

1 participant