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

#237 in Value formatting

Download history 182/week @ 2023-12-05 205/week @ 2023-12-12 201/week @ 2023-12-19 246/week @ 2023-12-26 257/week @ 2024-01-02 234/week @ 2024-01-09 212/week @ 2024-01-16 239/week @ 2024-01-23 189/week @ 2024-01-30 185/week @ 2024-02-06 220/week @ 2024-02-13 183/week @ 2024-02-20 204/week @ 2024-02-27 198/week @ 2024-03-05 211/week @ 2024-03-12 557/week @ 2024-03-19

1,204 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