Logo

Programming-Idioms

History of Idiom 176 > diff from v11 to v12

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

Version 11

2019-03-26, 21:23:37

Version 12

2019-04-10, 14:34:20

Idiom #176 Hex string to byte array

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

Idiom #176 Hex string to byte array

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

Extra Keywords
hexa
Extra Keywords
hexa
Imports
use hex::FromHex
Code
let a: Vec<u8> = Vec::from_hex(s).expect("Invalid Hex String");
Doc URL
https://docs.rs/hex/0.3.2/hex/trait.FromHex.html