[][src]Trait cast_rs::hexcast::ToHex

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

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>(&self, w: &mut W) -> Result<(), Error> where
    W: Write

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

fn write_hex_upper<W>(&self, w: &mut W) -> Result<(), Error> where
    W: Write

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

Loading content...

Implementors

impl<T> ToHex for T where
    T: AsRef<[u8]>, 
[src]

Loading content...