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