dbgtools_hexdump

Function hexdump_buf

Source
pub fn hexdump_buf<C, F>(cfg: C, buf: &[u8], f: F)
where C: Borrow<Config>, F: Fn(usize, &str, &str),
Expand description

Generate a hex dump of a byte buffer (&[u8]) and call a closure to process each hex dump line.

use dbgtools_hexdump::{Config, hexdump_buf};

let data: &[u8] = &[1, 2, 3, 4];

hexdump_buf(Config::default(), &data, |offs, hex, ascii| {
  println!("{:08x} {} {}", offs, hex, ascii);
});