[−][src]Trait hex::ToHex
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
fn write_hex<W: Write>(&self, w: &mut W) -> Result
Writes the hex string representing self
into w
. Lower case letters
are used (e.g. f9b4ca
).
fn write_hex_upper<W: Write>(&self, w: &mut W) -> Result
Writes the hex string representing self
into w
. Upper case letters
are used (e.g. F9B4CA
).