hex-display 0.3.0

Display impl for byte slices which provides a hexdump
Documentation
  • Coverage
  • 100%
    5 out of 5 items documented3 out of 4 items with examples
  • Size
  • Source code size: 5.54 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 374.52 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • JarredAllen/hex-display
    3 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • JarredAllen

hex-display

crates.io

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.

Example usage

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"
);