Skip to main content

FromHex

Trait FromHex 

Source
pub trait FromHex: Sized {
    // Required method
    fn from_hex(s: &str) -> Result<Self, DecodeError>;
}
Expand description

A trait to deserialize something from a hex-encoded string slice.

Examples:

use lexe_hex::hex::FromHex;
let s = String::from("e7f51d925349a26f742e6eef3670f489aaf14fbbb5b5c3f209892f2f1baae1c9");

<Vec<u8>>::from_hex(&s).unwrap();
<Cow<'_, [u8]>>::from_hex(&s).unwrap();
<[u8; 32]>::from_hex(&s).unwrap();

Required Methods§

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 FromHex for Cow<'_, [u8]>

Source§

impl FromHex for Vec<u8>

Source§

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

Implementors§