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 208/week @ 2024-01-17 251/week @ 2024-01-24 175/week @ 2024-01-31 186/week @ 2024-02-07 226/week @ 2024-02-14 193/week @ 2024-02-21 203/week @ 2024-02-28 190/week @ 2024-03-06 210/week @ 2024-03-13 621/week @ 2024-03-20 520/week @ 2024-03-27 365/week @ 2024-04-03 266/week @ 2024-04-10 251/week @ 2024-04-17 277/week @ 2024-04-24 188/week @ 2024-05-01

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