Crates.io | hex-display |
lib.rs | hex-display |
version | 0.3.0 |
source | src |
created_at | 2022-10-24 21:31:34.064264+00 |
updated_at | 2023-02-01 19:42:45.261427+00 |
description | Display impl for byte slices which provides a hexdump |
homepage | |
repository | https://github.com/JarredAllen/hex-display |
max_upload_size | |
id | 696272 |
size | 5,881 |
An implementation of Display on a wrapper for &[u8]
which provides a hexdump (see [Hex
] and
[HexDisplayExt
]). This crate also works in no_std
environments.
If std
is present, it can also convert to a hexdump as a string.
use hex_display::HexDisplayExt;
assert_eq!(
format!("{}", [0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef].hex()),
"0123456789abcdef"
);
#[cfg(feature = "std")]
assert_eq!(
[0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef].hex_string(),
"0123456789abcdef"
);