[][src]Trait hex::FromHex

pub trait FromHex: Sized {
    type Error;
    fn from_hex<T: AsRef<[u8]>>(hex: T) -> Result<Self, Self::Error>;
}

Types that can be decoded from a hex string.

This trait is implemented for Vec<u8> and small u8-arrays.

Example

use hex::FromHex;

match Vec::from_hex("48656c6c6f20776f726c6421") {
    Ok(vec) => {
        for b in vec {
            println!("{}", b as char);
        }
    }
    Err(e) => {
        // Deal with the error ...
    }
}

Associated Types

type Error

Loading content...

Required methods

fn from_hex<T: AsRef<[u8]>>(hex: T) -> Result<Self, Self::Error>

Creates an instance of type Self from the given hex string, or fails with a custom error type.

Both, upper and lower case characters are valid and can even be mixed (e.g. f9b4ca, F9B4CA and f9B4Ca are all valid strings).

Loading content...

Implementations on Foreign Types

impl FromHex for Vec<u8>[src]

type Error = FromHexError

impl FromHex for [u8; 1][src]

type Error = FromHexError

impl FromHex for [u8; 2][src]

type Error = FromHexError

impl FromHex for [u8; 3][src]

type Error = FromHexError

impl FromHex for [u8; 4][src]

type Error = FromHexError

impl FromHex for [u8; 5][src]

type Error = FromHexError

impl FromHex for [u8; 6][src]

type Error = FromHexError

impl FromHex for [u8; 7][src]

type Error = FromHexError

impl FromHex for [u8; 8][src]

type Error = FromHexError

impl FromHex for [u8; 9][src]

type Error = FromHexError

impl FromHex for [u8; 10][src]

type Error = FromHexError

impl FromHex for [u8; 11][src]

type Error = FromHexError

impl FromHex for [u8; 12][src]

type Error = FromHexError

impl FromHex for [u8; 13][src]

type Error = FromHexError

impl FromHex for [u8; 14][src]

type Error = FromHexError

impl FromHex for [u8; 15][src]

type Error = FromHexError

impl FromHex for [u8; 16][src]

type Error = FromHexError

impl FromHex for [u8; 17][src]

type Error = FromHexError

impl FromHex for [u8; 18][src]

type Error = FromHexError

impl FromHex for [u8; 19][src]

type Error = FromHexError

impl FromHex for [u8; 20][src]

type Error = FromHexError

impl FromHex for [u8; 21][src]

type Error = FromHexError

impl FromHex for [u8; 22][src]

type Error = FromHexError

impl FromHex for [u8; 23][src]

type Error = FromHexError

impl FromHex for [u8; 24][src]

type Error = FromHexError

impl FromHex for [u8; 25][src]

type Error = FromHexError

impl FromHex for [u8; 26][src]

type Error = FromHexError

impl FromHex for [u8; 27][src]

type Error = FromHexError

impl FromHex for [u8; 28][src]

type Error = FromHexError

impl FromHex for [u8; 29][src]

type Error = FromHexError

impl FromHex for [u8; 30][src]

type Error = FromHexError

impl FromHex for [u8; 31][src]

type Error = FromHexError

impl FromHex for [u8; 32][src]

type Error = FromHexError

impl FromHex for [u8; 33][src]

type Error = FromHexError

impl FromHex for [u8; 34][src]

type Error = FromHexError

impl FromHex for [u8; 35][src]

type Error = FromHexError

impl FromHex for [u8; 36][src]

type Error = FromHexError

impl FromHex for [u8; 37][src]

type Error = FromHexError

impl FromHex for [u8; 38][src]

type Error = FromHexError

impl FromHex for [u8; 39][src]

type Error = FromHexError

impl FromHex for [u8; 40][src]

type Error = FromHexError

impl FromHex for [u8; 41][src]

type Error = FromHexError

impl FromHex for [u8; 42][src]

type Error = FromHexError

impl FromHex for [u8; 43][src]

type Error = FromHexError

impl FromHex for [u8; 44][src]

type Error = FromHexError

impl FromHex for [u8; 45][src]

type Error = FromHexError

impl FromHex for [u8; 46][src]

type Error = FromHexError

impl FromHex for [u8; 47][src]

type Error = FromHexError

impl FromHex for [u8; 48][src]

type Error = FromHexError

impl FromHex for [u8; 49][src]

type Error = FromHexError

impl FromHex for [u8; 50][src]

type Error = FromHexError

impl FromHex for [u8; 51][src]

type Error = FromHexError

impl FromHex for [u8; 52][src]

type Error = FromHexError

impl FromHex for [u8; 53][src]

type Error = FromHexError

impl FromHex for [u8; 54][src]

type Error = FromHexError

impl FromHex for [u8; 55][src]

type Error = FromHexError

impl FromHex for [u8; 56][src]

type Error = FromHexError

impl FromHex for [u8; 57][src]

type Error = FromHexError

impl FromHex for [u8; 58][src]

type Error = FromHexError

impl FromHex for [u8; 59][src]

type Error = FromHexError

impl FromHex for [u8; 60][src]

type Error = FromHexError

impl FromHex for [u8; 61][src]

type Error = FromHexError

impl FromHex for [u8; 62][src]

type Error = FromHexError

impl FromHex for [u8; 63][src]

type Error = FromHexError

impl FromHex for [u8; 64][src]

type Error = FromHexError

impl FromHex for [u8; 65][src]

type Error = FromHexError

impl FromHex for [u8; 66][src]

type Error = FromHexError

impl FromHex for [u8; 67][src]

type Error = FromHexError

impl FromHex for [u8; 68][src]

type Error = FromHexError

impl FromHex for [u8; 69][src]

type Error = FromHexError

impl FromHex for [u8; 70][src]

type Error = FromHexError

impl FromHex for [u8; 71][src]

type Error = FromHexError

impl FromHex for [u8; 72][src]

type Error = FromHexError

impl FromHex for [u8; 73][src]

type Error = FromHexError

impl FromHex for [u8; 74][src]

type Error = FromHexError

impl FromHex for [u8; 75][src]

type Error = FromHexError

impl FromHex for [u8; 76][src]

type Error = FromHexError

impl FromHex for [u8; 77][src]

type Error = FromHexError

impl FromHex for [u8; 78][src]

type Error = FromHexError

impl FromHex for [u8; 79][src]

type Error = FromHexError

impl FromHex for [u8; 80][src]

type Error = FromHexError

impl FromHex for [u8; 81][src]

type Error = FromHexError

impl FromHex for [u8; 82][src]

type Error = FromHexError

impl FromHex for [u8; 83][src]

type Error = FromHexError

impl FromHex for [u8; 84][src]

type Error = FromHexError

impl FromHex for [u8; 85][src]

type Error = FromHexError

impl FromHex for [u8; 86][src]

type Error = FromHexError

impl FromHex for [u8; 87][src]

type Error = FromHexError

impl FromHex for [u8; 88][src]

type Error = FromHexError

impl FromHex for [u8; 89][src]

type Error = FromHexError

impl FromHex for [u8; 90][src]

type Error = FromHexError

impl FromHex for [u8; 91][src]

type Error = FromHexError

impl FromHex for [u8; 92][src]

type Error = FromHexError

impl FromHex for [u8; 93][src]

type Error = FromHexError

impl FromHex for [u8; 94][src]

type Error = FromHexError

impl FromHex for [u8; 95][src]

type Error = FromHexError

impl FromHex for [u8; 96][src]

type Error = FromHexError

impl FromHex for [u8; 97][src]

type Error = FromHexError

impl FromHex for [u8; 98][src]

type Error = FromHexError

impl FromHex for [u8; 99][src]

type Error = FromHexError

impl FromHex for [u8; 100][src]

type Error = FromHexError

impl FromHex for [u8; 101][src]

type Error = FromHexError

impl FromHex for [u8; 102][src]

type Error = FromHexError

impl FromHex for [u8; 103][src]

type Error = FromHexError

impl FromHex for [u8; 104][src]

type Error = FromHexError

impl FromHex for [u8; 105][src]

type Error = FromHexError

impl FromHex for [u8; 106][src]

type Error = FromHexError

impl FromHex for [u8; 107][src]

type Error = FromHexError

impl FromHex for [u8; 108][src]

type Error = FromHexError

impl FromHex for [u8; 109][src]

type Error = FromHexError

impl FromHex for [u8; 110][src]

type Error = FromHexError

impl FromHex for [u8; 111][src]

type Error = FromHexError

impl FromHex for [u8; 112][src]

type Error = FromHexError

impl FromHex for [u8; 113][src]

type Error = FromHexError

impl FromHex for [u8; 114][src]

type Error = FromHexError

impl FromHex for [u8; 115][src]

type Error = FromHexError

impl FromHex for [u8; 116][src]

type Error = FromHexError

impl FromHex for [u8; 117][src]

type Error = FromHexError

impl FromHex for [u8; 118][src]

type Error = FromHexError

impl FromHex for [u8; 119][src]

type Error = FromHexError

impl FromHex for [u8; 120][src]

type Error = FromHexError

impl FromHex for [u8; 121][src]

type Error = FromHexError

impl FromHex for [u8; 122][src]

type Error = FromHexError

impl FromHex for [u8; 123][src]

type Error = FromHexError

impl FromHex for [u8; 124][src]

type Error = FromHexError

impl FromHex for [u8; 125][src]

type Error = FromHexError

impl FromHex for [u8; 126][src]

type Error = FromHexError

impl FromHex for [u8; 127][src]

type Error = FromHexError

impl FromHex for [u8; 128][src]

type Error = FromHexError

impl FromHex for [u8; 160][src]

type Error = FromHexError

impl FromHex for [u8; 192][src]

type Error = FromHexError

impl FromHex for [u8; 200][src]

type Error = FromHexError

impl FromHex for [u8; 224][src]

type Error = FromHexError

impl FromHex for [u8; 256][src]

type Error = FromHexError

impl FromHex for [u8; 384][src]

type Error = FromHexError

impl FromHex for [u8; 512][src]

type Error = FromHexError

impl FromHex for [u8; 768][src]

type Error = FromHexError

impl FromHex for [u8; 1024][src]

type Error = FromHexError

impl FromHex for [u8; 2048][src]

type Error = FromHexError

impl FromHex for [u8; 4096][src]

type Error = FromHexError

impl FromHex for [u8; 8192][src]

type Error = FromHexError

impl FromHex for [u8; 16384][src]

type Error = FromHexError

impl FromHex for [u8; 32768][src]

type Error = FromHexError

impl FromHex for [u8; 65536][src]

type Error = FromHexError

impl FromHex for [u8; 131072][src]

type Error = FromHexError

impl FromHex for [u8; 262144][src]

type Error = FromHexError

impl FromHex for [u8; 524288][src]

type Error = FromHexError

impl FromHex for [u8; 1048576][src]

type Error = FromHexError

impl FromHex for [u8; 2097152][src]

type Error = FromHexError

impl FromHex for [u8; 4194304][src]

type Error = FromHexError

impl FromHex for [u8; 8388608][src]

type Error = FromHexError

impl FromHex for [u8; 16777216][src]

type Error = FromHexError

impl FromHex for [u8; 33554432][src]

type Error = FromHexError

impl FromHex for [u8; 67108864][src]

type Error = FromHexError

impl FromHex for [u8; 134217728][src]

type Error = FromHexError

impl FromHex for [u8; 268435456][src]

type Error = FromHexError

impl FromHex for [u8; 536870912][src]

type Error = FromHexError

impl FromHex for [u8; 1073741824][src]

type Error = FromHexError

impl FromHex for [u8; 2147483648][src]

type Error = FromHexError

impl FromHex for [u8; 4294967296][src]

type Error = FromHexError

Loading content...

Implementors

Loading content...