format_hex

Function format_hex 

Source
pub fn format_hex(buf: &[u8]) -> String
Expand description

Formats a octet slice into an uppercase, space-separated hexadecimal string.

This is a convenience function that formats the input octets into an uppercase hexadecimal string with spaces separating each octet.

§Parameters

  • buf: A slice of octets ([u8]) to format.

§Returns

A String containing the uppercase, space-separated hexadecimal representation.

§Examples

use hexify::format_hex;

let data = [0x42, 0xA4, 0xAE];
let hex = format_hex(&data);
assert_eq!(hex, "00000000  42 A4 AE                                          B..");