Logo

Programming-Idioms

History of Idiom 175 > diff from v10 to v11

Edit summary for version 11 by GobbleCock:
New Rust implementation by user [GobbleCock]

Version 10

2019-03-26, 21:24:42

Version 11

2019-04-10, 14:38:27

Idiom #175 Bytes to hex string

From array a of n bytes, build the equivalent hex string s of 2n digits.
Each byte (256 possible values) is encoded as two hexadecimal characters (16 possible values per digit).

Idiom #175 Bytes to hex string

From array a of n bytes, build the equivalent hex string s of 2n digits.
Each byte (256 possible values) is encoded as two hexadecimal characters (16 possible values per digit).

Extra Keywords
hexa
Extra Keywords
hexa
Imports
use hex::ToHex;
Code
let mut s = String::with_capactiy(2 * a.len());
a.write_hex(&mut s).expect("Failed to write");
Doc URL
https://docs.rs/hex/0.3.2/hex/trait.ToHex.html