]> git.lizzy.rs Git - rust.git/commit
Add hexadecimal formatting of integers with fmt::Debug
authorSimon Sapin <simon.sapin@exyr.org>
Tue, 13 Mar 2018 13:08:15 +0000 (14:08 +0100)
committerSimon Sapin <simon.sapin@exyr.org>
Tue, 13 Mar 2018 13:53:06 +0000 (14:53 +0100)
commit4897935e8645e5f1d9d9ef61c78a1cb019c44f89
treed32522f913ff690cfe6893ffe68d04d0ca2c2008
parent883e74645d350b6752cb94d48f46363f6f8789e9
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
src/liballoc/fmt.rs
src/libcore/fmt/mod.rs
src/libcore/fmt/num.rs
src/libcore/tests/fmt/num.rs
src/libfmt_macros/lib.rs