pub fn deserialize_exact<'de, T>(src: &'de [u8]) -> ReadResult<T>where
T: SchemaRead<'de, DefaultConfig, Dst = T>,Expand description
Deserialize a type from the given bytes and reject trailing bytes.
ยงExamples
let bytes = wincode::serialize(&123u64).unwrap();
let value: u64 = wincode::deserialize_exact(&bytes).unwrap();
assert_eq!(value, 123);
let mut extra = bytes.clone();
extra.push(0xAA);
assert!(wincode::deserialize_exact::<u64>(&extra).is_err());