Skip to content

Commit

Permalink
remove unused self from encode_frame
Browse files Browse the repository at this point in the history
  • Loading branch information
rgbkrk committed Dec 13, 2024
1 parent 174eb31 commit f255ba2
Showing 1 changed file with 19 additions and 21 deletions.
40 changes: 19 additions & 21 deletions src/codec/zmq_codec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,27 +120,25 @@ impl Decoder for ZmqCodec {
}
}

impl ZmqCodec {
fn _encode_frame(&mut self, frame: &Bytes, dst: &mut BytesMut, more: bool) {
let mut flags: u8 = 0;
if more {
flags |= 0b0000_0001;
}
let len = frame.len();
if len > 255 {
flags |= 0b0000_0010;
dst.reserve(len + 9);
} else {
dst.reserve(len + 2);
}
dst.put_u8(flags);
if len > 255 {
dst.put_u64(len as u64);
} else {
dst.put_u8(len as u8);
}
dst.extend_from_slice(frame.as_ref());
fn encode_frame(frame: &Bytes, dst: &mut BytesMut, more: bool) {
let mut flags: u8 = 0;
if more {
flags |= 0b0000_0001;
}
let len = frame.len();
if len > 255 {
flags |= 0b0000_0010;
dst.reserve(len + 9);
} else {
dst.reserve(len + 2);
}
dst.put_u8(flags);
if len > 255 {
dst.put_u64(len as u64);
} else {
dst.put_u8(len as u8);
}
dst.extend_from_slice(frame.as_ref());
}

impl Encoder for ZmqCodec {
Expand All @@ -154,7 +152,7 @@ impl Encoder for ZmqCodec {
Message::Message(message) => {
let last_element = message.len() - 1;
for (idx, part) in message.iter().enumerate() {
self._encode_frame(part, dst, idx != last_element);
encode_frame(part, dst, idx != last_element);
}
}
}
Expand Down

0 comments on commit f255ba2

Please sign in to comment.