Skip to main content

decode_to_vec

Function decode_to_vec 

Source
pub fn decode_to_vec(
    hex: &str,
) -> Result<Vec<u8>, DecodeVariableLengthBytesError>
Available on crate feature alloc only.
Expand description

Decodes a hex string with variable length.

The length of the returned Vec is determined by the length of the input, meaning all even lengths of the input string are allowed. If you know the required length at compile time using decode_to_array is most likely a better choice.

§Errors

Returns an error if hex contains invalid characters or doesn’t have even length.