Skip to content
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

Add u8::escape_default and [u8]::escape_default #80743

Closed
camelid opened this issue Jan 6, 2021 · 2 comments
Closed

Add u8::escape_default and [u8]::escape_default #80743

camelid opened this issue Jan 6, 2021 · 2 comments
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@camelid
Copy link
Member

camelid commented Jan 6, 2021

The standard library has several functions for printing escaped text:

  • char::escape_default for printing escaped Unicode characters
  • str::escape_default for printing escaped Unicode strings
  • std::ascii::escape_default for printing escaped ASCII bytes

I propose that we add associated functions to u8 and [u8] that are like
{char,str}::escape_default but for ASCII. The std::ascii::escape_default
function is not very discoverable – I was expecting a u8::escape_default
function like for char – and in fact I was about to post a question on
Stack Overflow when I found it in the std docs and posted an answer to
help others who also don't realize the existence of std::ascii::escape_default.

@camelid camelid added C-feature-request Category: A feature request, i.e: not implemented / a PR. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Jan 6, 2021
@m-ou-se
Copy link
Member

m-ou-se commented Jan 6, 2021

This sounds like #77174

@camelid
Copy link
Member Author

camelid commented Jan 6, 2021

Yep, I'll close this. Thanks!

@camelid camelid closed this as completed Jan 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants