Skip to main content

decode_from_hex_with_decoder

Function decode_from_hex_with_decoder 

Source
pub fn decode_from_hex_with_decoder<D: Decoder + Default>(
    hex: &str,
) -> Result<D::Output, FromHexError<D::Error>>
Expand description

Decodes an object from a hex string without heap allocations using a Decoder type.

Unlike decode_from_hex, this takes a generic Decoder parameter, allowing use with decoders which don’t have a dedicated Decode implementer (e.g. CompactSizeDecoder).

§Errors

FromHexError if the string has an odd number of characters, any character is not a valid hex digit, or if decoding the type fails, including if bytes remain unconsumed after the decoder completes.