[][src]Function pigeon::unpack_buffer

pub fn unpack_buffer<'a, U: Unpack<'a>>(buffer: &'a [u8]) -> Result<U>

Read a type which implement Unpack from the buffer.

This is a short-hand for creating a Reader and then calling read on that.

Examples

let buf = [12, 34, 56, 78];

let num: u32 = pigeon::unpack_buffer(&buf[..]).unwrap();

assert_eq!(num, 203569230);