pub trait EncodablePacket {
    fn fixed_header(&self) -> &FixedHeader;

    fn encode_packet<W: Write>(&self, _writer: &mut W) -> Result<()> { ... }
fn encoded_packet_length(&self) -> u32 { ... } }
Expand description

A trait representing a packet that can be encoded, when passed as FooPacket or as &FooPacket. Different from Encodable in that it prevents you from accidentally passing a type intended to be encoded only as a part of a packet and doesn’t have a header, e.g. Vec<u8>.

Required methods

Get a reference to FixedHeader. All MQTT packet must have a fixed header.

Provided methods

Encodes packet data after fixed header, including variable headers and payload

Length in bytes for data after fixed header, including variable headers and payload

Implementors