Skip to main content

decode_u16

Function decode_u16 

Source
pub fn decode_u16(buf: &mut ReadBuf<'_>) -> Result<u16>
Expand description

Decode a u16 varint from buf.

§Errors

The cursor is unchanged on error.

§Example

use wire_codec::{varint, ReadBuf};
let mut buf = ReadBuf::new(&[0xFF, 0xFF, 0x03]);
assert_eq!(varint::decode_u16(&mut buf).unwrap(), u16::MAX);