Trait revm_primitives::hex_literal::hex::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>;
}
👎Deprecated: use
ToHexExt
insteadExpand 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]
.
§Examples
#![allow(deprecated)]
use const_hex::ToHex;
assert_eq!("Hello world!".encode_hex::<String>(), "48656c6c6f20776f726c6421");
assert_eq!("Hello world!".encode_hex_upper::<String>(), "48656C6C6F20776F726C6421");
Required Methods§
sourcefn encode_hex<T>(&self) -> Twhere
T: FromIterator<char>,
👎Deprecated: use ToHexExt
instead
fn encode_hex<T>(&self) -> Twhere
T: FromIterator<char>,
ToHexExt
insteadEncode the hex strict representing self
into the result.
Lower case letters are used (e.g. f9b4ca
).
sourcefn encode_hex_upper<T>(&self) -> Twhere
T: FromIterator<char>,
👎Deprecated: use ToHexExt
instead
fn encode_hex_upper<T>(&self) -> Twhere
T: FromIterator<char>,
ToHexExt
insteadEncode the hex strict representing self
into the result.
Upper case letters are used (e.g. F9B4CA
).
Object Safety§
This trait is not object safe.