[][src]Function binascii::bin2hex

pub fn bin2hex<'a>(
    input: &[u8],
    output: &'a mut [u8]
) -> Result<&'a mut [u8], ConvertError>

Base16 Encoder - Converts binary to base16 (hex)

Example

use binascii::bin2hex;

let mut buffer = [0u8; 200];
let input = "Hello, World!";
println!("hex({}) = {:?}", input, bin2hex(input.as_bytes(), &mut buffer).ok().unwrap());

Failures

This function will fail with:

  • ConvertError::InvalidOutputLength - If the output's length isn't at least 2 times the input length.