hex-view

Crates.iohex-view
lib.rshex-view
version0.1.3
sourcesrc
created_at2017-09-29 22:07:19.998371
updated_at2019-07-09 23:47:17.599629
descriptionEasily format a &[u8] as hex.
homepage
repositoryhttps://github.com/paulkernfeld/hex-view
max_upload_size
id33942
size3,558
Paul Kernfeld (paulkernfeld)

documentation

https://crates.io/crates/hex-view

README

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

Commit count: 8

cargo fmt