Trait tari_utilities::hex::Hex

source ·
pub trait Hex {
    // Required methods
    fn from_hex(hex: &str) -> Result<Self, HexError>
       where Self: Sized;
    fn to_hex(&self) -> String;
}
Expand description

Any object implementing this trait has the ability to represent itself as a hexadecimal string and convert from it.

Required Methods§

source

fn from_hex(hex: &str) -> Result<Self, HexError>where Self: Sized,

Try to convert the given hexadecimal string to the type.

Errors

Any failures (incorrect string length, non hex characters, etc.) return a HexError with an explanatory note.

source

fn to_hex(&self) -> String

Return the hexadecimal string representation of the type.

Implementors§

source§

impl<T: ByteArray> Hex for T