rust/src/liballoc
bors 152217d29c Auto merge of #48978 - SimonSapin:debug-hex, r=KodrAus
Add hexadecimal formatting of integers with fmt::Debug

This can be used for integers within a larger types which implements Debug (possibly through derive) but not fmt::UpperHex or fmt::LowerHex.

```rust
assert!(format!("{:02x?}", b"Foo\0") == "[46, 6f, 6f, 00]");
assert!(format!("{:02X?}", b"Foo\0") == "[46, 6F, 6F, 00]");
```

RFC: https://github.com/rust-lang/rfcs/pull/2226

The new formatting string syntax (`x?` and `X?`) is insta-stable in this PR because I don’t know how to change a built-in proc macro’s behavior based of a feature gate. I can look into adding that, but I also strongly suspect that keeping this feature unstable for a time period would not be useful as possibly no-one would use it during that time.

This PR does not add the new (public) `fmt::Formatter` proposed in the API because:

* There was some skepticism on response to this part of the RFC
* It is not possible to implement as-is without larger changes to `fmt`, because `Formatter` at the moment has no easy way to tell apart for example `Octal` from `Binary`: it only has a function pointer for the relevant `fmt()` method.

If some integer-like type outside of `std` want to implement this behavior, another RFC will likely need to propose a different public API for `Formatter`.
2018-03-19 02:38:19 +00:00
..
benches Stabilize [T]::rotate_{left,right} 2018-02-22 20:12:38 -05:00
btree core: Update stability attributes for FusedIterator 2018-03-03 14:23:05 +01:00
tests Auto merge of #49051 - kennytm:rollup, r=kennytm 2018-03-16 00:09:14 +00:00
allocator.rs implementing fallible allocation API (try_reserve) for Vec, String and HashMap 2018-03-14 03:48:42 -07:00
arc.rs Rename Box::into_non_null_raw to Box::into_raw_non_null 2018-01-20 11:09:23 +01:00
binary_heap.rs core: Update stability attributes for FusedIterator 2018-03-03 14:23:05 +01:00
borrow.rs examples in Cow::into_owned don't need to wrap result in Cows 2017-11-14 18:23:24 -06:00
boxed.rs core: Update stability attributes for FusedIterator 2018-03-03 14:23:05 +01:00
boxed_test.rs Direct conversions between slices and boxes. 2017-02-06 18:53:13 -05:00
Cargo.toml Update Cargo submodule 2018-03-11 10:59:28 -07:00
fmt.rs Add hexadecimal formatting of integers with fmt::Debug 2018-03-13 14:53:06 +01:00
heap.rs Remove deprecated unstable alloc::heap::EMPTY constant 2018-03-16 11:45:16 +01:00
lib.rs Auto merge of #47813 - kennytm:stable-incl-range, r=nrc 2018-03-15 16:00:40 +00:00
linked_list.rs core: Update stability attributes for FusedIterator 2018-03-03 14:23:05 +01:00
macros.rs fix some typos 2017-11-21 15:33:45 +01:00
range.rs Stabilize inclusive_range library feature. 2018-03-15 16:58:01 +08:00
raw_vec.rs implementing fallible allocation API (try_reserve) for Vec, String and HashMap 2018-03-14 03:48:42 -07:00
rc.rs Rename Box::into_non_null_raw to Box::into_raw_non_null 2018-01-20 11:09:23 +01:00
slice.rs Stabilize [T]::rotate_{left,right} 2018-02-22 20:12:38 -05:00
str.rs Rollup merge of #47463 - bluss:fused-iterator, r=alexcrichton 2018-03-06 20:52:37 +08:00
string.rs Auto merge of #47813 - kennytm:stable-incl-range, r=nrc 2018-03-15 16:00:40 +00:00
vec.rs implementing fallible allocation API (try_reserve) for Vec, String and HashMap 2018-03-14 03:48:42 -07:00
vec_deque.rs implementing fallible allocation API (try_reserve) for Vec, String and HashMap 2018-03-14 03:48:42 -07:00