Open
Description
In std::fmt
:
x
prints integers in hexadecimal format#x
prefixes hexadecimal numbers with a 0x#?
pretty-prints the Debug formatting (e.g. one vector element per line)
The problem is that those are not orthogonal. #x?
will both add 0x and pretty-print. There does not seem to be a way to get one behavior without the other.
let v = [11];
/*
[11]
*/
println!("{:?}", v);
/*
[
11,
]
*/
println!("{:#?}", v);
/*
[b]
*/
println!("{:x?}", v);
/*
[
0xb,
]
*/
println!("{:#x?}", v);
/*
[
b,
]
*/
// ??
/*
[0xb]
*/
// ??
Could the #
modifier apply only to the closest type, so that #x?
, x#?
and #x#?
could be used to denote each case? (this would cause an output change for #x?
). Alternatively, another letter to denote "hexadecimal with 0x prefix"?