Function regex_automata::util::wire::try_read_u16
source ยท pub(crate) fn try_read_u16(
slice: &[u8],
what: &'static str,
) -> Result<(u16, usize), DeserializeError>
Expand description
Try to read a u16 from the beginning of the given slice in native endian
format. If the slice has fewer than 2 bytes, then this returns an error.
The error message will include the what
description of what is being
deserialized, for better error messages. what
should be a noun in
singular form.
Upon success, this also returns the number of bytes read.