[][src]Trait mqtt::packet::Packet

pub trait Packet: Sized {
    type Payload: Encodable + Decodable;
    fn fixed_header(&self) -> &FixedHeader;
fn payload(self) -> Self::Payload;
fn payload_ref(&self) -> &Self::Payload;
fn encode_variable_headers<W: Write>(
        &self,
        writer: &mut W
    ) -> Result<(), PacketError<Self>>;
fn encoded_variable_headers_length(&self) -> u32;
fn decode_packet<R: Read>(
        reader: &mut R,
        fixed_header: FixedHeader
    ) -> Result<Self, PacketError<Self>>; }

Methods for encoding and decoding a packet

Associated Types

Loading content...

Required methods

fn fixed_header(&self) -> &FixedHeader

Get a FixedHeader of this packet

fn payload(self) -> Self::Payload

Get the payload

fn payload_ref(&self) -> &Self::Payload

Get a borrow of payload

fn encode_variable_headers<W: Write>(
    &self,
    writer: &mut W
) -> Result<(), PacketError<Self>>

Encode variable headers to writer

fn encoded_variable_headers_length(&self) -> u32

Length of bytes after encoding variable header

fn decode_packet<R: Read>(
    reader: &mut R,
    fixed_header: FixedHeader
) -> Result<Self, PacketError<Self>>

Deocde packet with a FixedHeader

Loading content...

Implementors

impl Packet for ConnackPacket[src]

type Payload = ()

impl Packet for ConnectPacket[src]

type Payload = ConnectPacketPayload

impl Packet for DisconnectPacket[src]

type Payload = ()

impl Packet for PingreqPacket[src]

type Payload = ()

impl Packet for PingrespPacket[src]

type Payload = ()

impl Packet for PubackPacket[src]

type Payload = ()

impl Packet for PubcompPacket[src]

type Payload = ()

impl Packet for PublishPacket[src]

type Payload = Vec<u8>

impl Packet for PubrecPacket[src]

type Payload = ()

impl Packet for PubrelPacket[src]

type Payload = ()

impl Packet for SubackPacket[src]

type Payload = SubackPacketPayload

impl Packet for SubscribePacket[src]

type Payload = SubscribePacketPayload

impl Packet for UnsubackPacket[src]

type Payload = ()

impl Packet for UnsubscribePacket[src]

type Payload = UnsubscribePacketPayload

Loading content...