Expand description
This crate provides a fast conversion of byte arrays to hexadecimal strings, both at compile time, and at run time.
It aims to be a drop-in replacement for the hex crate, as well as
extending the API with const-eval, a
const-generics formatting buffer, similar to itoa’s, and more.
Version requirement: rustc 1.64+
Re-exports§
pub use traits::ToHexExt;allocpub use traits::FromHex;pub use traits::ToHex;Deprecated pub use self::serde::deserialize;pub use self::serde::serialize;allocpub use self::serde::serialize_upper;alloc
Modules§
Structs§
- Buffer
- A correctly sized stack allocation for the formatted bytes to be written into.
Enums§
- From
HexError - The error type for decoding a hex string into
Vec<u8>or[u8; N].
Constants§
- HEX_
CHARS_ LOWER - The table of lowercase characters used for hex encoding.
- HEX_
CHARS_ UPPER - The table of uppercase characters used for hex encoding.
- HEX_
DECODE_ LUT - The lookup table of hex byte to value, used for hex decoding.
- NIL
- Represents an invalid value in the
HEX_DECODE_LUTtable.
Functions§
- check
- Returns
trueif the input is a valid hex string and can be decoded successfully. - check_
raw - Returns
trueif the input is a valid hex string. - const_
check - Returns
trueif the input is a valid hex string and can be decoded successfully. - const_
check_ raw - Returns
trueif the input is a valid hex string. - const_
decode_ to_ array - Decode a hex string into a fixed-length byte-array.
- const_
encode - Encodes
inputas a hex string into aBuffer. - decode
alloc - Decodes a hex string into raw bytes.
- decode_
to_ array - Decode a hex string into a fixed-length byte-array.
- decode_
to_ slice - Decode a hex string into a mutable bytes slice.
- display
- Returns a value that can be formatted using the
fmttraits. - encode
alloc - Encodes
dataas a hex string using lowercase characters. - encode_
prefixed alloc - Encodes
dataas a prefixed hex string using lowercase characters. - encode_
to_ slice - Encodes
inputas a hex string using lowercase characters into a mutable slice of bytesoutput. - encode_
to_ slice_ upper - Encodes
inputas a hex string using uppercase characters into a mutable slice of bytesoutput. - encode_
to_ str - Encodes
inputas a hex string using lowercase characters into a mutable slice of bytesoutput. Returns the slice tooutputreinterpreted asstr. - encode_
to_ str_ upper - Encodes
inputas a hex string using uppercase characters into a mutable slice of bytesoutput. Returns the slice tooutputreinterpreted asstr. - encode_
upper alloc - Encodes
dataas a hex string using uppercase characters. - encode_
upper_ prefixed alloc - Encodes
dataas a prefixed hex string using uppercase characters.