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

pub trait Packet: Sized {
    type Payload: Encodable + Decodable;
    pub fn fixed_header(&self) -> &FixedHeader;
pub fn payload(self) -> Self::Payload;
pub fn payload_ref(&self) -> &Self::Payload;
pub fn encode_variable_headers<W: Write>(
        &self,
        writer: &mut W
    ) -> Result<(), PacketError<Self>>;
pub fn encoded_variable_headers_length(&self) -> u32;
pub 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

pub fn fixed_header(&self) -> &FixedHeader[src]

Get a FixedHeader of this packet

pub fn payload(self) -> Self::Payload[src]

Get the payload

pub fn payload_ref(&self) -> &Self::Payload[src]

Get a borrow of payload

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

Encode variable headers to writer

pub fn encoded_variable_headers_length(&self) -> u32[src]

Length of bytes after encoding variable header

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

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...