#hex #format #u8 #readability #human #multiline

format_hex

Formats an [u8] to an hexadecimal multiline format, for human readability

2 releases

0.1.1 Feb 9, 2025
0.1.0 Feb 3, 2025

#7 in #multiline

Download history 75/week @ 2025-01-29 145/week @ 2025-02-05 33/week @ 2025-02-12 6/week @ 2025-02-19 7/week @ 2025-02-26

231 downloads per month
Used in buf_read_splitter

MIT license

5KB
78 lines

format_hex

format_hex formats an [u8] to an hexadecimal multiline format, for human readability.

let (l1, l2, l3) = FormatHex::new()
   .push_hex(b"ABC")
   .push_comment(" deb[")
   .push_hex(b"DEFGHIJ")
   .push_comment("]fin ")
   .push_hex(b"KLMNzZ?\n\r\0")
   .output();
assert_eq!(l1, "ABC deb[DEFGHIJ]fin KLMNzZ?↳←�");
assert_eq!(l2, "444.....4444444.....4444753000");
assert_eq!(l3, "123.....456789A.....BCDEAAFAD0");

License: MIT


lib.rs:

format_hex formats an [u8] to an hexadecimal multiline format, for human readability.

let (l1, l2, l3) = FormatHex::new()
   .push_hex(b"ABC")
   .push_comment(" deb[")
   .push_hex(b"DEFGHIJ")
   .push_comment("]fin ")
   .push_hex(b"KLMNzZ?\n\r\0")
   .output();
assert_eq!(l1, "ABC deb[DEFGHIJ]fin KLMNzZ?↳←�");
assert_eq!(l2, "444.....4444444.....4444753000");
assert_eq!(l3, "123.....456789A.....BCDEAAFAD0");

No runtime deps