Module hex
Hexadecimal encoding and decoding.
hex provides encoding and decoding of binary data
to and from hexadecimal strings.
Examples
Basic encoding and decoding:
use ;
let data = b"Hello, world!";
let hex_string = encode;
println!; // "48656c6c6f2c20776f726c6421"
let decoded = decode.unwrap;
assert_eq!;
Uppercase hex encoding:
use encode_upper;
let data = b"ABC";
let hex_upper = encode_upper;
println!; // "414243"
Modules
-
serde
Hex encoding with
serde.
Traits
Functions
- decode Decodes a hex string into raw bytes.
- decode_to_slice Decode a hex string into a mutable bytes slice.
-
encode
Encodes
dataas hex string using lowercase characters. - encode_to_slice Encodes some bytes into a mutable slice of bytes.
-
encode_upper
Encodes
dataas hex string using uppercase characters.