Crates.io | hexplay |
lib.rs | hexplay |
version | 0.3.0 |
source | src |
created_at | 2017-03-02 20:50:13.159711 |
updated_at | 2023-05-03 19:56:59.981994 |
description | Format u8 slices like an hex editor |
homepage | |
repository | https://github.com/tmoers/hexplay |
max_upload_size | |
id | 8780 |
size | 39,100 |
Implements rust's Display trait to format a u8 slice as many hex editors do. This might be useful for dumping a binary blob for debugging purposes.
The API documentation can be found here: https://docs.rs/crate/hexplay/.
Here's an example that prints a hex view of a slice of some vector's data:
extern crate hexplay;
use hexplay::HexViewBuilder;
fn main() {
// The buffer we want to display
let data : Vec<u8> = (0u8..200u8).collect();
// Build a new HexView using the provider builder
let view = HexViewBuilder::new(&data[40..72])
.address_offset(40)
.row_width(16)
.finish();
println!("{}", view);
}
This will result in the following output:
00000020 28 29 2A 2B 2C 2D 2E 2F | ()*+,-./ |
00000030 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F | 0123456789:;<=>? |
00000040 40 41 42 43 44 45 46 47 | @ABCDEFG |
hexplay
is on crates.io, so you can include it in your project
like so:
[dependencies]
hexplay = "*"
Because this crate uses the ?
operator, you need rust v1.13.0
or higher.
Hexplay is licensed under the terms of the MIT license.