hex_dump_slice

Function hex_dump_slice 

Source
pub fn hex_dump_slice(ofs: usize, buf: &[u8], ascii: bool)
Expand description

Dumps the bytes in buf to the console as hex bytes, arranged 16 per line.

Each line is buffered into a String and printed in a single operation to avoid console race conditions in multi-threaded environments.

§Arguments

  • ofs - The starting offset for the first byte in buf.
  • buf - The slice of bytes to dump.
  • ascii - A flag to enable or disable the ASCII character view.

§Usage

let my_data: &[u8] = &[0xDE, 0xAD, 0xBE, 0xEF];
// This is a safe function and can be called directly.
hex_dump_slice(0x100, my_data, true);