pub fn decode_hexbyte(byte: u8) -> Result<u8, &'static str> {

    match byte {
        0x30 ... 0x3a     => Ok(byte - 0x30),
        0x41 ... 0x46     => Ok(byte - 0x41 + 0xa),
        0x61 ... 0x66     => Ok(byte - 0x61 + 0xa),
        0x0d              => Ok(0),     // TODO may want to end parsing here
        _                 => Err("Not a valid hexadecimal digit."),
    }
}
/// Converts a given hexadecimal character into the corresponding integer value
Converts a given hexadecimal character into the corresponding integer value
Converts a given hexadecimal character into the corresponding integer value
pub fn decode_hexbyte(byte: u8) -> Result<u8, &'static str> {
    match byte {
        0x30 ... 0x3a     => Ok(byte - 0x30),
        0x41 ... 0x46     => Ok(byte - 0x41 + 0xa),
        0x61 ... 0x66     => Ok(byte - 0x61 + 0xa),
        0x0d              => Ok(0),     // TODO may want to end parsing here
        _                 => Err("Not a valid hexadecimal digit."),
    }
}
pub fn decode_hexbyte ( byte : u8 ) -> Result < u8 , & ' static str > { match byte { 0x30 ... 0x3a => Ok ( byte - 0x30 ) , 0x41 ... 0x46 => Ok ( byte - 0x41 + 0xa ) , 0x61 ... 0x66 => Ok ( byte - 0x61 + 0xa ) , 0x0d => Ok ( 0 ) , // TODO may want to end parsing here _ => Err ( " " ) , } }
Converts a given hexadecimal character into the corresponding integer value
Converts a given hexadecimal character into the corresponding integer value
byte
u8
byte
u8