Closed hnj2 closed 2 years ago
It would be better if hex encoding were triggered by the {:x}
format string rather than replacing {}
. https://doc.rust-lang.org/std/fmt/#formatting-traits
https://github.com/japaric/ufmt/pull/35 adds support for {:x}
thanks for the PR. I agree with mutantbob
and prefer the alternative of having this on a separate trait rather than as a Cargo feature as that allows one to use both decimal and hexadecimal formatting in the crate based on the format string.
This feature will cause the
uDebug
implementation of for integer primitives to print hexadecimal representations of those integers.Advantages:
In various cases this can be useful:
uDebug
implementation foruxx
can be resued forixx
Drawbacks:
uDisplay
anduDebug
are used for someixx
oruxx
type, then less code can be reused with thedebug_hex
featureAlternatives:
uHex
type together with a derive macro could be used to implement fromats with{:x?}
and{:#x?}
.