pub fn read_bytes<'a, T: ToFromBytes<'a>>(
buffer: &'a [u8],
) -> Result<(T, usize), ToFromByteError>Expand description
Low-level read: deserialize a value and return how many bytes were consumed.
Does NOT check for trailing bytes. Use this when:
- You’re parsing multiple messages from one buffer
- You’re implementing streaming parsers
- You have a length prefix and want to stop exactly there
Do NOT use this function without confirming that the reader.pos is at the correct position afterwards. Silently ignoring trailing bytes is a common source of errors and security bugs.