Repository navigation
Conversation
tomtomwombat
reviewed
Oct 3, 2026
tomtomwombat
left a comment
Owner
There was a problem hiding this comment.
Ok, the overall approach looks good so far. I'm curious if you had a use case for this? Should there be an ArenaArcString?
| /// Deallocation happens by dropping the arena, which will free all strings allocated in it. | ||
| /// | ||
| /// See [`ColdString`] for method documentation. | ||
|
|
| use std::string::String; | ||
| use bumpalo::Bump; | ||
|
|
||
| fn alloc_str<'a>(s: &str, arena: &'a Bump) -> ArenaString<'a> { |
Owner
There was a problem hiding this comment.
what's the point of alloc_str wrapper?
|
|
||
| impl<H> Encoded<H> { | ||
| #[inline] | ||
| pub(crate) fn new(s: &str, header: H) -> Self { |
Owner
There was a problem hiding this comment.
Can we move this to line 50 instead of a new impl block
This file contains hidden or 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
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.
This add the type ArenaString which allocates long strings to an arena allocator instead of the global allocator.
The first commit adds infrastructure for using the Allocator trait, and the second adds the new string type.
Note that this does not add a phantom type parameter to Encoded for the allocator, to keep the diff smaller, but it means that there is no lifetime restriction in Encoded, allowing to get an Encoded with a longer lifetime than the allocator. Not an issue for the current code since that is handled correctly in the string types, but it could be worth adding if other use cases involving custom allocators are discovered.
Ignore the change to edition and resolver in Cargo.toml. Will remove that after review. (Just discovered I forgot that in there)