Trait hex::ToHex [] [src]

pub trait ToHex {
    fn write_hex<W: Write>(&self, w: &mut W) -> Result;
fn write_hex_upper<W: Write>(&self, w: &mut W) -> Result; }

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;

let mut s = String::new();
"Hello world!".write_hex(&mut s).unwrap();
println!("{}", s);

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

Required Methods

Writes the hex string representing self into w. Lower case letters are used (e.g. f9b4ca).

Writes the hex string representing self into w. Upper case letters are used (e.g. F9B4CA).

Implementors