Skip to content

Conversation

@SimonSapin
Copy link
Contributor

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 and std::ascii::StrAsciiExt traits, but rename to remove Str since that does not apply for bytes.

This PR also makes std::ascii::ASCII_UPPER_MAP and std::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

@alexcrichton
Copy link
Member

I agree that this doesn't need an RFC, it's ok to do outside of that process. Could you leave the old names in places like so?

#[deprecated = "this trait has been renamed to `AsciiExt`"]
pub use StrAsciiExt = AsciiExt;

I would prefer to keep the [breaking-change] tag, however because this will eventually become a breaking change.

@SimonSapin
Copy link
Contributor Author

Oh, I tried pub trait StrAsciiExt: AsciiExt {}, but other modules use’ing StrAsciiExt could not use the methods anymore so that was useless. pub use should work, I didn’t think of that.

@alexcrichton
Copy link
Member

ping? Sorry this fell under the radar, this is probably good to go with a rebase.

@SimonSapin
Copy link
Contributor Author

I’d forgotten about this myself. Rebased.

bors added a commit that referenced this pull request Jul 30, 2014
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` and `std::ascii::StrAsciiExt` traits, but rename to remove `Str` since that does not apply for bytes.

This PR also makes `std::ascii::ASCII_UPPER_MAP` and `std::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
@bors bors closed this Jul 30, 2014
@SimonSapin SimonSapin deleted the pub-ascii-maps branch September 20, 2014 19:25
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.

3 participants