Implement ASCII case-related method on Vec<u8> and &[u8] #15777
Closed
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.
When dealing with HTTP request or responses, many tokens are case-insensitive in the ASCII range but the bytes from the network are not necessarily valid UTF-8.
[breaking-change] Rather than adding new very similar traits, this re-uses the
std::ascii::OwnedStrAsciiExt
andstd::ascii::StrAsciiExt
traits, but rename to removeStr
since that does not apply for bytes.This PR also makes
std::ascii::ASCII_UPPER_MAP
andstd::ascii::ASCII_LOWER_MAP
, the lookup table all these methods are based on, public. In case there is something else related to ASCII case we haven’t thought of yet, that can be implemented outside of libstd without duplicating the tables.Although this is a breaking change, I thought this could do without an RFC since the relevant traits are not in the prelude.
r? @alexcrichton