rustc_hex

Trait ToHex

Source
pub trait ToHex {
    // Required method
    fn to_hex<T: FromIterator<char>>(&self) -> T;
}
Expand description

A trait for converting a value to hexadecimal encoding

Required Methods§

Source

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

Converts the value of self to a hex value, constructed from an iterator of characters.

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§

Source§

impl ToHex for [u8]

Source§

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

Turn a slice of u8 bytes into a hexadecimal string.

§Example
use rustc_hex::ToHex;

fn main () {
    let str: String = [52,32].to_hex();
    println!("{}", str);
}
Source§

impl<'a, T: ?Sized + ToHex> ToHex for &'a T

Source§

fn to_hex<U: FromIterator<char>>(&self) -> U

Implementors§