Function qdhex::write_formatted_dump_to_vec
source · pub fn write_formatted_dump_to_vec(
offset: u32,
data: &[u8],
target: &mut Vec<u8>
)Expand description
Write a formatted multi-line hex dump of the given data to the given target. Dump lines are prefixed with the given offset. Each line contains up to 16 bytes, separated by spaces, followed by a space and the ASCII representation.
Examples
let data = &b"baadfood\xba\xad\xf0\x0dASDFasdf;lkj."[..];
let mut target = Vec::new();
qdhex::write_formatted_dump_to_vec(0x1000, &data, &mut target);
assert_eq!(target, br"1000 62 61 61 64 66 6f 6f 64 ba ad f0 0d 41 53 44 46 baadfood....ASDF
1010 61 73 64 66 3b 6c 6b 6a 2e asdf;lkj.
");