Open
Conversation
This was referenced Jun 25, 2025
Closed
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.
Makes the crate unconditionally
#![no_std]and pulls inextern crate allocandextern crate stdas configured by feature flags (stdremains the default).All functionality other than
HeaderMap::try_from::<std::collections::HashMap>can be implemented withalloc+hashbrown, so this crate should be usable on embedded platforms functionally as-is.Without
alloc, we can only provide support for methods, status codes, versions, and standard header names, a pretty limited subset of functionality, though still useful for consistent types in contexts without allocation. I'd be very interested in working on a future PR addingheaplesssupport (if the maintainers are amenable) so that most of this crate can work without an allocator, but that won't make it into this PR.Worth noting that #732 exists -- not aiming to tread on toes, I just wasn't aware of it until I went to submit this.
All tests pass with all combinations of feature flags.
Compatibility / substantive changes
Almost all the changes in this PR are mechanical renamings of
stdimports tocoreoralloc. The next most common changes are adding#[cfg(feature = "alloc")]where appropriate.There are no functional or compatibility changes with the
stdfeature flag, and dropping toallocfromstdonly removes theHeaderMap::try_from<std::collections::HashMap>impl (while one is still provided forhashbrown::HashMapandalloc::collections::BTreeMap).Some code changes were necessary to support non-
allocenvironments -- these are inheader/name.rs,method.rs, anduri/scheme.rs: