array_bytes

Trait TryFromHex

Source
pub trait TryFromHex
where Self: Sized,
{ // Required method fn try_from_hex<H>(hex: H) -> Result<Self> where H: AsRef<[u8]>; }
Expand description

Try to convert the given hex to a specific type.

§Examples

use array_bytes::TryFromHex;

assert_eq!(u128::try_from_hex("0x5201314"), Ok(85_988_116));

Required Methods§

Source

fn try_from_hex<H>(hex: H) -> Result<Self>
where H: AsRef<[u8]>,

Try to convert Self from hex.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl TryFromHex for i8

Source§

fn try_from_hex<H>(hex: H) -> Result<Self>
where H: AsRef<[u8]>,

Source§

impl TryFromHex for i16

Source§

fn try_from_hex<H>(hex: H) -> Result<Self>
where H: AsRef<[u8]>,

Source§

impl TryFromHex for i32

Source§

fn try_from_hex<H>(hex: H) -> Result<Self>
where H: AsRef<[u8]>,

Source§

impl TryFromHex for i64

Source§

fn try_from_hex<H>(hex: H) -> Result<Self>
where H: AsRef<[u8]>,

Source§

impl TryFromHex for i128

Source§

fn try_from_hex<H>(hex: H) -> Result<Self>
where H: AsRef<[u8]>,

Source§

impl TryFromHex for isize

Source§

fn try_from_hex<H>(hex: H) -> Result<Self>
where H: AsRef<[u8]>,

Source§

impl TryFromHex for u8

Source§

fn try_from_hex<H>(hex: H) -> Result<Self>
where H: AsRef<[u8]>,

Source§

impl TryFromHex for u16

Source§

fn try_from_hex<H>(hex: H) -> Result<Self>
where H: AsRef<[u8]>,

Source§

impl TryFromHex for u32

Source§

fn try_from_hex<H>(hex: H) -> Result<Self>
where H: AsRef<[u8]>,

Source§

impl TryFromHex for u64

Source§

fn try_from_hex<H>(hex: H) -> Result<Self>
where H: AsRef<[u8]>,

Source§

impl TryFromHex for u128

Source§

fn try_from_hex<H>(hex: H) -> Result<Self>
where H: AsRef<[u8]>,

Source§

impl TryFromHex for usize

Source§

fn try_from_hex<H>(hex: H) -> Result<Self>
where H: AsRef<[u8]>,

Source§

impl TryFromHex for Vec<u8>

Source§

fn try_from_hex<H>(hex: H) -> Result<Self>
where H: AsRef<[u8]>,

Source§

impl TryFromHex for SmallVec<[u8; 64]>

Source§

fn try_from_hex<H>(hex: H) -> Result<Self>
where H: AsRef<[u8]>,

Source§

impl<const N: usize> TryFromHex for [u8; N]

Source§

fn try_from_hex<H>(hex: H) -> Result<Self>
where H: AsRef<[u8]>,

Implementors§