-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat!: implement collections using a BumpAllocator
parameter
#38
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bluurryy
added
enhancement
New feature or request
breaking
This is a breaking change
labels
Nov 14, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We reimplement the collections so instead of
we now have
This should clean up the api and implementation nicely but also add complexity in that we now have to account for
A
being anything and not just&BumpScope
.BumpAllocator
will gain new methods for more optimized versions ofallocate
and friends so the generated code does not degrade.With the new trait
BumpAllocatorScope<'a>
we can dish out objects for the'a
lifetime from functions likeinto_slice
. Most functions don't need to know about the bump scope lifetime soBumpAllocator
suffices. Some validBumpAllocator
s can't implementBumpAllocatorScope<'a>
likeBump
(but&'a Bump
can).With this trait based design we should be able to replaceMut*
collections by implementing the mut optimizations on their non-mut container equivalents whenever theBumpAllocator
supports this.We still need separate
Mut*
collections because inMut*
collections we need to protect the allocator and make sure no one can access it.Todo:
Bump{Vec,String}
usingBumpAllocator(Scope)
MutBump{Vec,String}
usingBumpAllocator(Scope)
(GuaranteedAllocated)Stats<'a, UP>
with a new(GuaranteedAllocated)Stats<'a>
add migration guideno, there are no straightforward migration steps from what i can tellMut*
prefix instead to match the collections (the collections themselves match theFixed*
prefix)