pub(crate) fn try_read_u16_as_usize(
    slice: &[u8],
    what: &'static str
) -> Result<(usize, usize), DeserializeError>
Expand description

Try to read a u16 as a usize from the beginning of the given slice in native endian format. If the slice has fewer than 2 bytes or if the deserialized number cannot be represented by usize, 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.