mirror of
https://github.com/sharkdp/hexyl.git
synced 2026-10-30 09:05:54 +00:00
Add simple hexyl-as-a-library example, see #81
This commit is contained in:
1 parent
67b6c2533d
commit
abc79396df
1 file changed
+20
@@ -0,0 +1,20 @@
|
|||||||
|
use std::io;
|
||||||
|
|
||||||
|
use hexyl::{BorderStyle, Printer};
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let input = vec![
|
||||||
|
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44,
|
||||||
|
0x52, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x44, 0x08, 0x02, 0x00, 0x00, 0x00,
|
||||||
|
];
|
||||||
|
|
||||||
|
let stdout = io::stdout();
|
||||||
|
let mut handle = stdout.lock();
|
||||||
|
|
||||||
|
let show_color = true;
|
||||||
|
let use_squeezing = false;
|
||||||
|
let border_style = BorderStyle::Unicode;
|
||||||
|
|
||||||
|
let mut printer = Printer::new(&mut handle, show_color, border_style, use_squeezing);
|
||||||
|
printer.print_all(&input[..], None).unwrap();
|
||||||
|
}
|
||||||
Reference in new issue
Block a user