mqute_codec/protocol/v4/
packet.rs

1//! # MQTT Packet V4
2//!
3//! This module defines the `Packet` enum, which represents all possible MQTT packet types
4//! for the MQTT v4 (3.1.1) protocol. The `packet!` macro is used to generate the `Packet` enum
5//! and its associated methods for encoding and decoding.
6
7use crate::protocol::common::util::packet;
8
9use super::{
10    ConnAck, Connect, Disconnect, PingReq, PingResp, PubAck, PubComp, PubRec, PubRel, Publish,
11    SubAck, Subscribe, UnsubAck, Unsubscribe,
12};
13
14// Represents all MQTT packet types for MQTT v4 (3.1.1).
15// The `Packet` enum is generated using the `packet!` macro and includes variants for each
16// MQTT packet type.
17packet!(
18    Packet,
19    Connect,
20    ConnAck,
21    Publish,
22    PubAck,
23    PubRec,
24    PubRel,
25    PubComp,
26    Subscribe,
27    SubAck,
28    Unsubscribe,
29    UnsubAck,
30    PingReq,
31    PingResp,
32    Disconnect
33);