rust/library/alloc/src
Matthias Krüger 08d5b2303a
Rollup merge of #135073 - joshtriplett:bstr, r=BurntSushi
Implement `ByteStr` and `ByteString` types

Approved ACP: https://github.com/rust-lang/libs-team/issues/502
Tracking issue: https://github.com/rust-lang/rust/issues/134915

These types represent human-readable strings that are conventionally,
but not always, UTF-8. The `Debug` impl prints non-UTF-8 bytes using
escape sequences, and the `Display` impl uses the Unicode replacement
character.

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`, and `Borrow`,
when those would be the second implementation for a type (counting the
`T` impl), to avoid potential inference failures. We can attempt to add
more impls later in standalone commits, and run them through crater.

In addition to the `bstr` feature, I've added a `bstr_internals` feature
for APIs provided by `core` for use by `alloc` but not currently
intended for stabilization.

This API and its implementation are based *heavily* on the `bstr` crate
by Andrew Gallant (`@BurntSushi).`

r? `@BurntSushi`
2025-01-23 19:54:23 +01:00
..
boxed replace placeholder version 2024-11-27 12:10:21 +00:00
collections Remove erroneous unsafe in BTreeSet::upper_bound_mut 2025-01-22 18:36:33 +03:00
ffi docs: inline alloc::ffi::c_str types to alloc::ffi 2024-12-28 15:42:39 +01:00
raw_vec Polymorphize RawVec 2024-08-09 20:06:26 -04:00
rc Use c"lit" for CStrings without unwrap 2024-12-02 18:16:36 +00:00
testing Reformat use declarations. 2024-07-29 08:26:52 +10:00
vec Add another Vec::splice example 2025-01-13 17:37:09 -06:00
alloc.rs turn rustc_box into an intrinsic 2025-01-03 12:01:31 +01:00
borrow.rs remove const_cow_is_borrowed feature gate 2024-10-12 19:48:28 +02:00
boxed.rs update cfg(bootstrap) 2025-01-08 21:26:39 +01:00
bstr.rs Add doc aliases for BStr and BString 2025-01-22 09:19:24 +02:00
fmt.rs Added struct fmt::FormattingOptions 2024-12-05 21:48:01 +01:00
lib.miri.rs add 'x.py miri', and make it work for 'library/{core,alloc,std}' 2024-04-03 20:27:20 +02:00
lib.rs Rollup merge of #135073 - joshtriplett:bstr, r=BurntSushi 2025-01-23 19:54:23 +01:00
macros.rs Update the explanation for why we use box_new in vec! 2025-01-12 13:17:16 -05:00
raw_vec.rs Update a bunch of library types for MCP807 2025-01-09 23:47:11 -08:00
rc.rs Make UniqueRc invariant for soundness 2025-01-11 22:36:25 +01:00
slice.rs Change GetManyMutError to match T-libs-api decision 2024-11-28 23:34:47 +02:00
str.rs Inline str::repeat 2024-11-06 18:54:50 +00:00
string.rs Impl String::into_chars 2024-12-22 19:48:36 +08:00
sync.rs Rollup merge of #134496 - DiuDiu777:fix-doc, r=ibraheemdev 2025-01-16 17:00:45 +01:00
task.rs Stabilize noop_waker 2024-12-05 14:14:17 -08:00