Trait const_hex::ToHex

source ·
pub trait ToHex {
    // Required methods
    fn encode_hex<T: FromIterator<char>>(&self) -> T;
    fn encode_hex_upper<T: FromIterator<char>>(&self) -> T;
}
👎Deprecated: use encode or other specialized functions instead
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].

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

Examples

#![allow(deprecated)]
use const_hex::ToHex;

assert_eq!("Hello world!".encode_hex::<String>(), "48656c6c6f20776f726c6421");

Required Methods§

source

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

👎Deprecated: use encode or other specialized functions instead

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

source

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

👎Deprecated: use encode or other specialized functions instead

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

Implementors§

source§

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