Trait UpperHex
trait UpperHex: PointeeSized
X formatting.
The UpperHex trait should format its output as a number in hexadecimal, with A through F
in upper case.
For primitive signed integers (i8 to i128, and isize),
negative values are formatted as the two’s complement representation.
The alternate flag, #, adds a 0x in front of the output.
For more information on formatters, see the module-level documentation.
Examples
Basic usage with i32:
let y = 42; // 42 is '2A' in hex
assert_eq!;
assert_eq!;
assert_eq!;
Implementing UpperHex on a type:
use fmt;
;
let l = Length;
assert_eq!;
assert_eq!;
Required Methods
fn fmt(self: &Self, f: &mut Formatter<'_>) -> ResultFormats the value using the given formatter.
Errors
This function should return
Errif, and only if, the providedFormatterreturnsErr. String formatting is considered an infallible operation; this function only returns aResultbecause writing to the underlying stream might fail and it must provide a way to propagate the fact that an error has occurred back up the stack.
Implementors
impl UpperHex for i8impl UpperHex for u128impl UpperHex for u16impl UpperHex for i128impl UpperHex for i16impl<T: PointeeSized + UpperHex> UpperHex for &Timpl<T: fmt::UpperHex> UpperHex for Saturating<T>impl UpperHex for u32impl<T: PointeeSized + UpperHex> UpperHex for &mut Timpl UpperHex for usizeimpl UpperHex for i32impl<T: fmt::UpperHex> UpperHex for Wrapping<T>impl UpperHex for isizeimpl UpperHex for u64impl UpperHex for u8impl UpperHex for i64impl<T> UpperHex for NonZero<T>