pub fn decode<T: Decode>(buf: &[u8]) -> Result<(T, usize)>Expand description
Decodes a value from a slice, returning the value and encoded length.
Unlike the array-based functions, this validates the input: the slice only needs to hold the value’s actual encoding, and invalid prefixes or out-of-range values are rejected.