bytes_to_hex

Function bytes_to_hex 

Source
pub fn bytes_to_hex(bytes: &[u8]) -> String
Expand description

Converts a byte slice to its hexadecimal string representation.

This function takes a slice of bytes and returns a String containing the hexadecimal representation of those bytes. Each byte is converted to a two-character hexadecimal string.

§Arguments

  • bytes - A slice of bytes to convert to hexadecimal.

§Returns

A String containing the hexadecimal representation of the input bytes.

§Example

let bytes = &[15, 255, 0, 128];
let hex_string = byteutils::bytes_to_hex(bytes);
assert_eq!(byteutils::bytes_to_hex(bytes), "0fff0080");