Skip to content

Commit 25a59de

Browse files
remove first_byte function
1 parent d96cb78 commit 25a59de

File tree

1 file changed

+0
-30
lines changed

1 file changed

+0
-30
lines changed

mqrstt/src/packets/mod.rs

-30
Original file line numberDiff line numberDiff line change
@@ -83,36 +83,6 @@ impl Packet {
8383
}
8484
}
8585

86-
pub(crate) fn first_byte(&self) -> u8 {
87-
match self {
88-
Packet::Connect(_) => 0b0001_0000,
89-
Packet::ConnAck(_) => 0b0010_0000,
90-
Packet::Publish(p) => {
91-
let mut first_byte = 0b0011_0000u8;
92-
if p.dup {
93-
first_byte |= 0b1000;
94-
}
95-
first_byte |= p.qos.into_u8() << 1;
96-
if p.retain {
97-
first_byte |= 0b0001;
98-
}
99-
first_byte
100-
}
101-
Packet::PubAck(_) => 0b0100_0000,
102-
Packet::PubRec(_) => 0b0101_0000,
103-
Packet::PubRel(_) => 0b0110_0010,
104-
Packet::PubComp(_) => 0b0111_0000,
105-
Packet::Subscribe(_) => 0b1000_0010,
106-
Packet::SubAck(_) => 0b1001_0000,
107-
Packet::Unsubscribe(_) => 0b1010_0010,
108-
Packet::UnsubAck(_) => 0b1011_0000,
109-
Packet::PingReq => 0b1100_0000,
110-
Packet::PingResp => 0b1101_0000,
111-
Packet::Disconnect(_) => 0b1110_0000,
112-
Packet::Auth(_) => 0b1111_0000,
113-
}
114-
}
115-
11686
pub(crate) fn write(&self, buf: &mut BytesMut) -> Result<(), SerializeError> {
11787
match self {
11888
Packet::Connect(p) => {

0 commit comments

Comments
 (0)