4 releases

Uses old Rust 2015

0.1.3 Jul 9, 2019
0.1.2 Nov 2, 2017
0.1.1 Sep 29, 2017
0.1.0 Sep 29, 2017

#25 in #formatted

Download history 205/week @ 2024-07-28 168/week @ 2024-08-04 205/week @ 2024-08-11 171/week @ 2024-08-18 163/week @ 2024-08-25 168/week @ 2024-09-01 133/week @ 2024-09-08 152/week @ 2024-09-15 169/week @ 2024-09-22 152/week @ 2024-09-29 181/week @ 2024-10-06 170/week @ 2024-10-13 134/week @ 2024-10-20 158/week @ 2024-10-27 156/week @ 2024-11-03 134/week @ 2024-11-10

606 downloads per month
Used in fwupd-dbus

MIT/Apache

4KB

hex-view

NOTE: As of Rust 1.26.0, this crate is no longer necessary because an &[u8] can be formatted as hex using the :x? and :X? formatters.

Easily format a &[u8] as hex.

use hex_view::HexView;

let ff00_slice: &[u8] = &[255, 0];
assert_eq!(format!("{:x}", HexView::from(&ff00_slice)), "ff00")

HexView::from also works on anything that implements AsRef<[u8]>, such as a &Vec<u8>:

use hex_view::HexView;

let ff00_vec: Vec<u8> = vec![255, 0];
assert_eq!(format!("{:X}", HexView::from(&ff00_vec)), "FF00")

License: MIT/Apache-2.0


lib.rs:

NOTE: As of Rust 1.26.0, this crate is no longer necessary because an &[u8] can be formatted as hex using the :x? and :X? formatters.

Easily format a &[u8] as hex.

use hex_view::HexView;

let ff00_slice: &[u8] = &[255, 0];
assert_eq!(format!("{:x}", HexView::from(&ff00_slice)), "ff00")

HexView::from also works on anything that implements AsRef<[u8]>, such as a &Vec<u8>:

use hex_view::HexView;

let ff00_vec: Vec<u8> = vec![255, 0];
assert_eq!(format!("{:X}", HexView::from(&ff00_vec)), "FF00")

No runtime deps