aboutsummaryrefslogtreecommitdiffhomepage
path: root/libs/hbb_common/src/bytes_codec.rs
diff options
context:
space:
mode:
Diffstat (limited to 'libs/hbb_common/src/bytes_codec.rs')
-rw-r--r--libs/hbb_common/src/bytes_codec.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/libs/hbb_common/src/bytes_codec.rs b/libs/hbb_common/src/bytes_codec.rs
index e029f1c..699aa9b 100644
--- a/libs/hbb_common/src/bytes_codec.rs
+++ b/libs/hbb_common/src/bytes_codec.rs
@@ -15,6 +15,12 @@ enum DecodeState {
Data(usize),
}
+impl Default for BytesCodec {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl BytesCodec {
pub fn new() -> Self {
Self {
@@ -56,7 +62,7 @@ impl BytesCodec {
}
src.advance(head_len);
src.reserve(n);
- return Ok(Some(n));
+ Ok(Some(n))
}
fn decode_data(&self, n: usize, src: &mut BytesMut) -> io::Result<Option<BytesMut>> {