Function decode

Source
pub fn decode<'de, T>(src: &'de [u8]) -> DecodeResult<T>
where T: Decode<'de>,
Expand description

Decodes a value of type T from a byte slice.

This function creates a ReadCursor from the input byte slice and uses it to decode a value of type T that implements the Decode trait.

§Arguments

  • src - A byte slice containing the data to be decoded.

§Returns

Returns a DecodeResult<T>, which is either the successfully decoded value or a DecodeError if decoding fails.