Function unpack_octets_as_u16

pub fn unpack_octets_as_u16(buf: &[u8], offset: usize) -> u16
Expand description

A helper function that unpacks a sequence of 2 bytes found in the buffer with starting at the given offset, into a u16.

§Examples

use rama_utils::octets::unpack_octets_as_u16;
let buf: [u8; 2] = [0, 1];
assert_eq!(1u16, unpack_octets_as_u16(&buf, 0));

§Panics

In case the buffer is too small.