pub trait HexDisplayExt {
// Required method
fn hex(&self) -> Hex<'_>;
// Provided methods
fn upper_hex_string(&self) -> String { ... }
fn hex_string(&self) -> String { ... }
}Expand description
An extension trait that allows for more easily constructing Hex values
use hex_display::HexDisplayExt;
assert_eq!(
format!("{}", [0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef].hex()),
"0123456789abcdef"
);
assert_eq!(
format!("{:X}", [0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef].hex()),
"0123456789ABCDEF"
);Required Methods§
Provided Methods§
Sourcefn upper_hex_string(&self) -> String
fn upper_hex_string(&self) -> String
Convert to a upper-case hex string
Only present when built with alloc support.
Sourcefn hex_string(&self) -> String
fn hex_string(&self) -> String
Convert to a lower-case hex string
Only present when built with alloc support.