pub fn decode_from_slice<D: Decode>(src: &[u8]) -> Result<(D, usize)>Expand description
Decode a value from a byte slice using the standard configuration.
Returns the decoded value and the number of bytes consumed.
ยงExamples
let bytes = oxicode::encode_to_vec(&1234u32).expect("encode failed");
let (value, consumed): (u32, _) = oxicode::decode_from_slice(&bytes).expect("decode failed");
assert_eq!(value, 1234u32);
assert_eq!(consumed, bytes.len());