pub trait ReadPacketExt: AsRef<[u8]> {
// Provided method
fn read_packet(&self) -> Result<Packet<'_>, IError> { ... }
}
Expand description
Extends AsRef<[u8]>
with methods for reading packet.
use mqtt::{ReadPacketExt, Packet};
assert_eq!(b"\xd0\x00".read_packet().unwrap(), Packet::PingResponse);
Provided Methods§
Sourcefn read_packet(&self) -> Result<Packet<'_>, IError>
fn read_packet(&self) -> Result<Packet<'_>, IError>
Read packet from the underlying reader.