mqtt_protocol_core/mqtt/packet/
kind.rs1pub trait PacketKind {
54 const IS_CONNECT: bool = false;
56 const IS_CONNACK: bool = false;
58 const IS_PUBLISH: bool = false;
60 const IS_PUBACK: bool = false;
62 const IS_PUBREC: bool = false;
64 const IS_PUBREL: bool = false;
66 const IS_PUBCOMP: bool = false;
68 const IS_SUBSCRIBE: bool = false;
70 const IS_SUBACK: bool = false;
72 const IS_UNSUBSCRIBE: bool = false;
74 const IS_UNSUBACK: bool = false;
76 const IS_PINGREQ: bool = false;
78 const IS_PINGRESP: bool = false;
80 const IS_DISCONNECT: bool = false;
82 const IS_AUTH: bool = false;
84 const IS_V3_1_1: bool = false;
86 const IS_V5_0: bool = false;
88}
89
90impl PacketKind for crate::mqtt::packet::v3_1_1::Connect {
94 const IS_CONNECT: bool = true;
95 const IS_V3_1_1: bool = true;
96}
97
98impl PacketKind for crate::mqtt::packet::v3_1_1::Connack {
100 const IS_CONNACK: bool = true;
101 const IS_V3_1_1: bool = true;
102}
103
104impl PacketKind for crate::mqtt::packet::v5_0::Connect {
106 const IS_CONNECT: bool = true;
107 const IS_V5_0: bool = true;
108}
109
110impl PacketKind for crate::mqtt::packet::v5_0::Connack {
112 const IS_CONNACK: bool = true;
113 const IS_V5_0: bool = true;
114}
115
116impl PacketKind for crate::mqtt::packet::v3_1_1::Pingreq {
120 const IS_PINGREQ: bool = true;
121 const IS_V3_1_1: bool = true;
122}
123
124impl PacketKind for crate::mqtt::packet::v3_1_1::Pingresp {
126 const IS_PINGRESP: bool = true;
127 const IS_V3_1_1: bool = true;
128}
129
130impl PacketKind for crate::mqtt::packet::v3_1_1::Disconnect {
132 const IS_DISCONNECT: bool = true;
133 const IS_V3_1_1: bool = true;
134}
135
136impl PacketKind for crate::mqtt::packet::v5_0::Pingreq {
140 const IS_PINGREQ: bool = true;
141 const IS_V5_0: bool = true;
142}
143
144impl PacketKind for crate::mqtt::packet::v5_0::Pingresp {
145 const IS_PINGRESP: bool = true;
146 const IS_V5_0: bool = true;
147}
148
149impl PacketKind for crate::mqtt::packet::v5_0::Disconnect {
150 const IS_DISCONNECT: bool = true;
151 const IS_V5_0: bool = true;
152}
153
154impl PacketKind for crate::mqtt::packet::v5_0::Auth {
156 const IS_AUTH: bool = true;
157 const IS_V5_0: bool = true;
158}
159
160impl<T: PacketKind> PacketKind for &T {
165 const IS_CONNECT: bool = T::IS_CONNECT;
166 const IS_CONNACK: bool = T::IS_CONNACK;
167 const IS_PUBLISH: bool = T::IS_PUBLISH;
168 const IS_PUBACK: bool = T::IS_PUBACK;
169 const IS_PUBREC: bool = T::IS_PUBREC;
170 const IS_PUBREL: bool = T::IS_PUBREL;
171 const IS_PUBCOMP: bool = T::IS_PUBCOMP;
172 const IS_SUBSCRIBE: bool = T::IS_SUBSCRIBE;
173 const IS_SUBACK: bool = T::IS_SUBACK;
174 const IS_UNSUBSCRIBE: bool = T::IS_UNSUBSCRIBE;
175 const IS_UNSUBACK: bool = T::IS_UNSUBACK;
176 const IS_PINGREQ: bool = T::IS_PINGREQ;
177 const IS_PINGRESP: bool = T::IS_PINGRESP;
178 const IS_DISCONNECT: bool = T::IS_DISCONNECT;
179 const IS_AUTH: bool = T::IS_AUTH;
180 const IS_V3_1_1: bool = T::IS_V3_1_1;
181 const IS_V5_0: bool = T::IS_V5_0;
182}
183
184impl<PacketIdType> PacketKind for crate::mqtt::packet::GenericPacket<PacketIdType>
191where
192 PacketIdType: crate::mqtt::packet::IsPacketId + serde::Serialize,
193{
194 }
196
197impl<PacketIdType> PacketKind for crate::mqtt::packet::v3_1_1::GenericPublish<PacketIdType>
201where
202 PacketIdType: crate::mqtt::packet::IsPacketId,
203 PacketIdType: 'static, {
205 const IS_PUBLISH: bool = true;
206 const IS_V3_1_1: bool = true;
207}
208
209impl<PacketIdType> PacketKind for crate::mqtt::packet::v3_1_1::GenericPuback<PacketIdType>
210where
211 PacketIdType: crate::mqtt::packet::IsPacketId,
212{
213 const IS_PUBACK: bool = true;
214 const IS_V3_1_1: bool = true;
215}
216
217impl<PacketIdType> PacketKind for crate::mqtt::packet::v3_1_1::GenericPubrec<PacketIdType>
218where
219 PacketIdType: crate::mqtt::packet::IsPacketId,
220{
221 const IS_PUBREC: bool = true;
222 const IS_V3_1_1: bool = true;
223}
224
225impl<PacketIdType> PacketKind for crate::mqtt::packet::v3_1_1::GenericPubrel<PacketIdType>
226where
227 PacketIdType: crate::mqtt::packet::IsPacketId,
228{
229 const IS_PUBREL: bool = true;
230 const IS_V3_1_1: bool = true;
231}
232
233impl<PacketIdType> PacketKind for crate::mqtt::packet::v3_1_1::GenericPubcomp<PacketIdType>
234where
235 PacketIdType: crate::mqtt::packet::IsPacketId,
236{
237 const IS_PUBCOMP: bool = true;
238 const IS_V3_1_1: bool = true;
239}
240
241impl<PacketIdType> PacketKind for crate::mqtt::packet::v3_1_1::GenericSubscribe<PacketIdType>
242where
243 PacketIdType: crate::mqtt::packet::IsPacketId,
244{
245 const IS_SUBSCRIBE: bool = true;
246 const IS_V3_1_1: bool = true;
247}
248
249impl<PacketIdType> PacketKind for crate::mqtt::packet::v3_1_1::GenericSuback<PacketIdType>
250where
251 PacketIdType: crate::mqtt::packet::IsPacketId,
252{
253 const IS_SUBACK: bool = true;
254 const IS_V3_1_1: bool = true;
255}
256
257impl<PacketIdType> PacketKind for crate::mqtt::packet::v3_1_1::GenericUnsubscribe<PacketIdType>
258where
259 PacketIdType: crate::mqtt::packet::IsPacketId,
260{
261 const IS_UNSUBSCRIBE: bool = true;
262 const IS_V3_1_1: bool = true;
263}
264
265impl<PacketIdType> PacketKind for crate::mqtt::packet::v3_1_1::GenericUnsuback<PacketIdType>
266where
267 PacketIdType: crate::mqtt::packet::IsPacketId,
268{
269 const IS_UNSUBACK: bool = true;
270 const IS_V3_1_1: bool = true;
271}
272
273impl<PacketIdType> PacketKind for crate::mqtt::packet::v5_0::GenericPublish<PacketIdType>
275where
276 PacketIdType: crate::mqtt::packet::IsPacketId,
277{
278 const IS_PUBLISH: bool = true;
279 const IS_V5_0: bool = true;
280}
281
282impl<PacketIdType> PacketKind for crate::mqtt::packet::v5_0::GenericPuback<PacketIdType>
283where
284 PacketIdType: crate::mqtt::packet::IsPacketId,
285{
286 const IS_PUBACK: bool = true;
287 const IS_V5_0: bool = true;
288}
289
290impl<PacketIdType> PacketKind for crate::mqtt::packet::v5_0::GenericPubrec<PacketIdType>
291where
292 PacketIdType: crate::mqtt::packet::IsPacketId,
293{
294 const IS_PUBREC: bool = true;
295 const IS_V5_0: bool = true;
296}
297
298impl<PacketIdType> PacketKind for crate::mqtt::packet::v5_0::GenericPubrel<PacketIdType>
299where
300 PacketIdType: crate::mqtt::packet::IsPacketId,
301{
302 const IS_PUBREL: bool = true;
303 const IS_V5_0: bool = true;
304}
305
306impl<PacketIdType> PacketKind for crate::mqtt::packet::v5_0::GenericPubcomp<PacketIdType>
307where
308 PacketIdType: crate::mqtt::packet::IsPacketId,
309{
310 const IS_PUBCOMP: bool = true;
311 const IS_V5_0: bool = true;
312}
313
314impl<PacketIdType> PacketKind for crate::mqtt::packet::v5_0::GenericSubscribe<PacketIdType>
315where
316 PacketIdType: crate::mqtt::packet::IsPacketId,
317{
318 const IS_SUBSCRIBE: bool = true;
319 const IS_V5_0: bool = true;
320}
321
322impl<PacketIdType> PacketKind for crate::mqtt::packet::v5_0::GenericSuback<PacketIdType>
323where
324 PacketIdType: crate::mqtt::packet::IsPacketId,
325{
326 const IS_SUBACK: bool = true;
327 const IS_V5_0: bool = true;
328}
329
330impl<PacketIdType> PacketKind for crate::mqtt::packet::v5_0::GenericUnsubscribe<PacketIdType>
331where
332 PacketIdType: crate::mqtt::packet::IsPacketId,
333{
334 const IS_UNSUBSCRIBE: bool = true;
335 const IS_V5_0: bool = true;
336}
337
338impl<PacketIdType> PacketKind for crate::mqtt::packet::v5_0::GenericUnsuback<PacketIdType>
339where
340 PacketIdType: crate::mqtt::packet::IsPacketId,
341{
342 const IS_UNSUBACK: bool = true;
343 const IS_V5_0: bool = true;
344}