Skip to content

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

Closed
@camelid

Description

@camelid

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions