pub trait PacketKind {
const IS_CONNECT: bool = false;
const IS_CONNACK: bool = false;
const IS_PUBLISH: bool = false;
const IS_PUBACK: bool = false;
const IS_PUBREC: bool = false;
const IS_PUBREL: bool = false;
const IS_PUBCOMP: bool = false;
const IS_SUBSCRIBE: bool = false;
const IS_SUBACK: bool = false;
const IS_UNSUBSCRIBE: bool = false;
const IS_UNSUBACK: bool = false;
const IS_PINGREQ: bool = false;
const IS_PINGRESP: bool = false;
const IS_DISCONNECT: bool = false;
const IS_AUTH: bool = false;
const IS_V3_1_1: bool = false;
const IS_V5_0: bool = false;
}
impl PacketKind for crate::mqtt::packet::v3_1_1::Connect {
const IS_CONNECT: bool = true;
const IS_V3_1_1: bool = true;
}
impl PacketKind for crate::mqtt::packet::v3_1_1::Connack {
const IS_CONNACK: bool = true;
const IS_V3_1_1: bool = true;
}
impl PacketKind for crate::mqtt::packet::v5_0::Connect {
const IS_CONNECT: bool = true;
const IS_V5_0: bool = true;
}
impl PacketKind for crate::mqtt::packet::v5_0::Connack {
const IS_CONNACK: bool = true;
const IS_V5_0: bool = true;
}
impl PacketKind for crate::mqtt::packet::v3_1_1::Pingreq {
const IS_PINGREQ: bool = true;
const IS_V3_1_1: bool = true;
}
impl PacketKind for crate::mqtt::packet::v3_1_1::Pingresp {
const IS_PINGRESP: bool = true;
const IS_V3_1_1: bool = true;
}
impl PacketKind for crate::mqtt::packet::v3_1_1::Disconnect {
const IS_DISCONNECT: bool = true;
const IS_V3_1_1: bool = true;
}
impl PacketKind for crate::mqtt::packet::v5_0::Pingreq {
const IS_PINGREQ: bool = true;
const IS_V5_0: bool = true;
}
impl PacketKind for crate::mqtt::packet::v5_0::Pingresp {
const IS_PINGRESP: bool = true;
const IS_V5_0: bool = true;
}
impl PacketKind for crate::mqtt::packet::v5_0::Disconnect {
const IS_DISCONNECT: bool = true;
const IS_V5_0: bool = true;
}
impl PacketKind for crate::mqtt::packet::v5_0::Auth {
const IS_AUTH: bool = true;
const IS_V5_0: bool = true;
}
impl<T: PacketKind> PacketKind for &T {
const IS_CONNECT: bool = T::IS_CONNECT;
const IS_CONNACK: bool = T::IS_CONNACK;
const IS_PUBLISH: bool = T::IS_PUBLISH;
const IS_PUBACK: bool = T::IS_PUBACK;
const IS_PUBREC: bool = T::IS_PUBREC;
const IS_PUBREL: bool = T::IS_PUBREL;
const IS_PUBCOMP: bool = T::IS_PUBCOMP;
const IS_SUBSCRIBE: bool = T::IS_SUBSCRIBE;
const IS_SUBACK: bool = T::IS_SUBACK;
const IS_UNSUBSCRIBE: bool = T::IS_UNSUBSCRIBE;
const IS_UNSUBACK: bool = T::IS_UNSUBACK;
const IS_PINGREQ: bool = T::IS_PINGREQ;
const IS_PINGRESP: bool = T::IS_PINGRESP;
const IS_DISCONNECT: bool = T::IS_DISCONNECT;
const IS_AUTH: bool = T::IS_AUTH;
const IS_V3_1_1: bool = T::IS_V3_1_1;
const IS_V5_0: bool = T::IS_V5_0;
}
impl<PacketIdType> PacketKind for crate::mqtt::packet::GenericPacket<PacketIdType>
where
PacketIdType: crate::mqtt::packet::IsPacketId + serde::Serialize,
{
}
impl<PacketIdType> PacketKind for crate::mqtt::packet::v3_1_1::GenericPublish<PacketIdType>
where
PacketIdType: crate::mqtt::packet::IsPacketId,
PacketIdType: 'static, {
const IS_PUBLISH: bool = true;
const IS_V3_1_1: bool = true;
}
impl<PacketIdType> PacketKind for crate::mqtt::packet::v3_1_1::GenericPuback<PacketIdType>
where
PacketIdType: crate::mqtt::packet::IsPacketId,
{
const IS_PUBACK: bool = true;
const IS_V3_1_1: bool = true;
}
impl<PacketIdType> PacketKind for crate::mqtt::packet::v3_1_1::GenericPubrec<PacketIdType>
where
PacketIdType: crate::mqtt::packet::IsPacketId,
{
const IS_PUBREC: bool = true;
const IS_V3_1_1: bool = true;
}
impl<PacketIdType> PacketKind for crate::mqtt::packet::v3_1_1::GenericPubrel<PacketIdType>
where
PacketIdType: crate::mqtt::packet::IsPacketId,
{
const IS_PUBREL: bool = true;
const IS_V3_1_1: bool = true;
}
impl<PacketIdType> PacketKind for crate::mqtt::packet::v3_1_1::GenericPubcomp<PacketIdType>
where
PacketIdType: crate::mqtt::packet::IsPacketId,
{
const IS_PUBCOMP: bool = true;
const IS_V3_1_1: bool = true;
}
impl<PacketIdType> PacketKind for crate::mqtt::packet::v3_1_1::GenericSubscribe<PacketIdType>
where
PacketIdType: crate::mqtt::packet::IsPacketId,
{
const IS_SUBSCRIBE: bool = true;
const IS_V3_1_1: bool = true;
}
impl<PacketIdType> PacketKind for crate::mqtt::packet::v3_1_1::GenericSuback<PacketIdType>
where
PacketIdType: crate::mqtt::packet::IsPacketId,
{
const IS_SUBACK: bool = true;
const IS_V3_1_1: bool = true;
}
impl<PacketIdType> PacketKind for crate::mqtt::packet::v3_1_1::GenericUnsubscribe<PacketIdType>
where
PacketIdType: crate::mqtt::packet::IsPacketId,
{
const IS_UNSUBSCRIBE: bool = true;
const IS_V3_1_1: bool = true;
}
impl<PacketIdType> PacketKind for crate::mqtt::packet::v3_1_1::GenericUnsuback<PacketIdType>
where
PacketIdType: crate::mqtt::packet::IsPacketId,
{
const IS_UNSUBACK: bool = true;
const IS_V3_1_1: bool = true;
}
impl<PacketIdType> PacketKind for crate::mqtt::packet::v5_0::GenericPublish<PacketIdType>
where
PacketIdType: crate::mqtt::packet::IsPacketId,
{
const IS_PUBLISH: bool = true;
const IS_V5_0: bool = true;
}
impl<PacketIdType> PacketKind for crate::mqtt::packet::v5_0::GenericPuback<PacketIdType>
where
PacketIdType: crate::mqtt::packet::IsPacketId,
{
const IS_PUBACK: bool = true;
const IS_V5_0: bool = true;
}
impl<PacketIdType> PacketKind for crate::mqtt::packet::v5_0::GenericPubrec<PacketIdType>
where
PacketIdType: crate::mqtt::packet::IsPacketId,
{
const IS_PUBREC: bool = true;
const IS_V5_0: bool = true;
}
impl<PacketIdType> PacketKind for crate::mqtt::packet::v5_0::GenericPubrel<PacketIdType>
where
PacketIdType: crate::mqtt::packet::IsPacketId,
{
const IS_PUBREL: bool = true;
const IS_V5_0: bool = true;
}
impl<PacketIdType> PacketKind for crate::mqtt::packet::v5_0::GenericPubcomp<PacketIdType>
where
PacketIdType: crate::mqtt::packet::IsPacketId,
{
const IS_PUBCOMP: bool = true;
const IS_V5_0: bool = true;
}
impl<PacketIdType> PacketKind for crate::mqtt::packet::v5_0::GenericSubscribe<PacketIdType>
where
PacketIdType: crate::mqtt::packet::IsPacketId,
{
const IS_SUBSCRIBE: bool = true;
const IS_V5_0: bool = true;
}
impl<PacketIdType> PacketKind for crate::mqtt::packet::v5_0::GenericSuback<PacketIdType>
where
PacketIdType: crate::mqtt::packet::IsPacketId,
{
const IS_SUBACK: bool = true;
const IS_V5_0: bool = true;
}
impl<PacketIdType> PacketKind for crate::mqtt::packet::v5_0::GenericUnsubscribe<PacketIdType>
where
PacketIdType: crate::mqtt::packet::IsPacketId,
{
const IS_UNSUBSCRIBE: bool = true;
const IS_V5_0: bool = true;
}
impl<PacketIdType> PacketKind for crate::mqtt::packet::v5_0::GenericUnsuback<PacketIdType>
where
PacketIdType: crate::mqtt::packet::IsPacketId,
{
const IS_UNSUBACK: bool = true;
const IS_V5_0: bool = true;
}