mqute_codec/protocol/v3/
packet.rs

1//! # MQTT Packet V3
2//!
3//! This module implements the MQTT v3 (3.1) packet types using the `packet!` macro.
4//! It defines a unified `Packet` enum that encapsulates all MQTT packet types supported
5//! in the v3 protocol.
6
7use crate::protocol::common::util::packet;
8
9use crate::protocol::v4::{
10    Disconnect, PingReq, PingResp, PubAck, PubComp, PubRec, PubRel, Publish, Subscribe, UnsubAck,
11    Unsubscribe,
12};
13
14use super::{ConnAck, Connect, SubAck};
15
16// Represents an MQTT v3 (3.1) packet.
17// The `Packet` enum encapsulates all MQTT packet types supported in the v3 protocol.
18// It is generated using the `packet!` macro, which provides methods for encoding and decoding
19// MQTT packets.
20packet!(
21    Packet,
22    Connect,
23    ConnAck,
24    Publish,
25    PubAck,
26    PubRec,
27    PubRel,
28    PubComp,
29    Subscribe,
30    SubAck,
31    Unsubscribe,
32    UnsubAck,
33    PingReq,
34    PingResp,
35    Disconnect
36);