Crate hexify

Source
Expand description

§hexify

hexify is a Rust library for formatting octet slices ([u8]) into hexadecimal (hex) strings. It provides utilities to convert octets into hex strings.

§Installation

Add hexify to your Cargo.toml:

[dependencies]
hexify = "0.0.1"

§Usage

use hexify::{format_hex};

let data = [0x42, 0xA4, 0xAE, 0x09, 0xAF, 0x00, 0x01, 0x00, 0x00, 0x04, 0x03, 0x00, 0x00];

let output = format_hex(&data);
println!("{}", output); // Outputs: 42 A4 AE 09 AF 00 01 00 00 04 03 00 00

Functions§

assert_eq_slices
Asserts that two octet slices are equal. If not, panics and displays a formatted hex dump comparison.
compare_eq_slices
Checks if two octet slices are equal. If not, returns an error with the formatted hex dump comparison.
format_hex
Formats a octet slice into an uppercase, space-separated hexadecimal string.
format_hex_dump_comparison
format_hex_dump_comparison_width
format_hex_u32_be
format_hex_with_prefix_and_separator