cast::revm::interpreter::primitives::alloy_primitives::hex

Trait ToHex

Source
pub trait ToHex {
    // Required methods
    fn encode_hex<T>(&self) -> T
       where T: FromIterator<char>;
    fn encode_hex_upper<T>(&self) -> T
       where T: FromIterator<char>;
}
Expand description

Encoding values as hex string.

This trait is implemented for all T which implement AsRef<[u8]>. This includes String, str, Vec<u8> and [u8].

§Example

use hex::ToHex;

println!("{}", "Hello world!".encode_hex::<String>());

Note: instead of using this trait, you might want to use encode().

Required Methods§

Source

fn encode_hex<T>(&self) -> T
where T: FromIterator<char>,

Encode the hex strict representing self into the result. Lower case letters are used (e.g. f9b4ca)

Source

fn encode_hex_upper<T>(&self) -> T
where T: FromIterator<char>,

Encode the hex strict representing self into the result. Upper case letters are used (e.g. F9B4CA)

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.

Implementors§

Source§

impl<T> ToHex for T
where T: AsRef<[u8]>,