[][src]Trait hexutil::ParseHex

pub trait ParseHex {
    fn parse_hex<T: FromHex>(self) -> Result<T, FromHexError>;
}

Parse a hexadecimal value.

struct Test(u16);

hexutil::impl_from_hex!(Test, 2, |data| Ok(Self(u16::from_le_bytes(data))));

let test: Test = "3412".parse_hex().unwrap();
assert_eq!(test, Test(0x1234));

Required methods

fn parse_hex<T: FromHex>(self) -> Result<T, FromHexError>

Parse the hexadecimal string representation and create a value of type T.

Loading content...

Implementations on Foreign Types

impl<'_> ParseHex for &'_ str[src]

impl<'_> ParseHex for &'_ [u8][src]

Loading content...

Implementors

Loading content...