Skip to main content

decode_from_slice_unbounded

Function decode_from_slice_unbounded 

Source
pub fn decode_from_slice_unbounded<T>(
    bytes: &mut &[u8],
) -> Result<T, <T::Decoder as Decoder>::Error>
where T: Decodable,
Expand description

Decodes an object from an unbounded byte slice.

Unlike decode_from_slice, this function will not error if the slice contains additional bytes that are not required to decode. Furthermore, the byte slice reference provided to this function will be updated based on the consumed data, returning the unconsumed bytes.

ยงErrors

Returns an error if the decoder encounters an error while parsing the data, including insufficient data.