Implement ByteStr and ByteString types - #135073
Merged
Merged
Conversation
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.
Approved ACP: rust-lang/libs-team#502
Tracking issue: #134915
These types represent human-readable strings that are conventionally,
but not always, UTF-8. The
Debugimpl prints non-UTF-8 bytes usingescape sequences, and the
Displayimpl uses the Unicode replacementcharacter.
This is a minimal implementation of these types and associated trait
impls. It does not add any helper methods to other types such as
[u8]or
Vec<u8>.I've omitted a few implementations of
AsRef,AsMut,Borrow,From, andPartialOrd, when those would be the second implementationfor a type (counting the
Timpl) or otherwise may cause inferencefailures. These impls are important, but we can attempt to add them
later in standalone commits, and run them through crater.
In addition to the
bstrfeature, I've added abstr_internalsfeaturefor APIs provided by
corefor use byallocbut not currentlyintended for stabilization.
This API and its implementation are based heavily on the
bstrcrateby Andrew Gallant (@BurntSushi).
r? @BurntSushi