Trait FromHex

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§

fn from_hex(s: &str) -> Result<Self, DecodeError>

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§

§

impl FromHex for Cow<'_, [u8]>

§

fn from_hex(s: &str) -> Result<Cow<'_, [u8]>, DecodeError>

§

impl FromHex for Vec<u8>

§

impl FromHex for Hash

§

fn from_hex(s: &str) -> Result<Hash, DecodeError>

§

impl FromHex for KeyPair

§

fn from_hex(s: &str) -> Result<KeyPair, DecodeError>

§

impl FromHex for LxChannelId

§

fn from_hex(s: &str) -> Result<LxChannelId, DecodeError>

§

impl FromHex for LxUserChannelId

§

fn from_hex(s: &str) -> Result<LxUserChannelId, DecodeError>

§

impl FromHex for MachineId

§

fn from_hex(s: &str) -> Result<MachineId, DecodeError>

§

impl FromHex for Measurement

§

fn from_hex(s: &str) -> Result<Measurement, DecodeError>

§

impl FromHex for MrShort

§

fn from_hex(s: &str) -> Result<MrShort, DecodeError>

§

impl FromHex for OfferId

§

fn from_hex(s: &str) -> Result<OfferId, DecodeError>

§

impl FromHex for PaymentPreimage

§

fn from_hex(s: &str) -> Result<PaymentPreimage, DecodeError>

§

impl FromHex for PublicKey

§

fn from_hex(s: &str) -> Result<PublicKey, DecodeError>

§

impl FromHex for ShortUserPk

§

fn from_hex(s: &str) -> Result<ShortUserPk, DecodeError>

§

impl FromHex for Signature

§

fn from_hex(s: &str) -> Result<Signature, DecodeError>

§

impl FromHex for UserPk

§

fn from_hex(s: &str) -> Result<UserPk, DecodeError>

§

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

Implementors§