hex
Hexadecimal encoding and decoding with typed errors.
Decoding accepts either case and rejects anything that is not pairs of hex digits, so trim
whitespace and strip 0x prefixes before calling it.
Install
Section titled “Install”Cargo feature hex (enabled by default). To compile only this module:
or in Cargo.toml:
Import path: helpers4::hex.
| Item | What it does |
|---|---|
decode | Decodes a hexadecimal string (either case) into bytes. |
decode_array | Decodes a hexadecimal string into a fixed-size array, e.g. |
decode_to_slice | Decodes a hexadecimal string into out, which must be exactly half as long as the string. |
encode | Encodes bytes as lowercase hexadecimal. |
encode_upper | Encodes bytes as uppercase hexadecimal. |
Error types
Section titled “Error types”Documented on the page of the helper that returns them.
| Type | Returned by |
|---|---|
DecodeError | decode, decode_array, decode_to_slice |
