Function read_packet

Source
pub fn read_packet(i: &[u8]) -> Result<(&[u8], Packet<'_>), IError>
Expand description

Read packet from the underlying &[u8].

use mqtt::{read_packet, Packet};

assert_eq!(read_packet(b"\xc0\x00\xd0\x00").unwrap(), (&b"\xd0\x00"[..], Packet::PingRequest));