调整代码

This commit is contained in:
lbl8603
2024-06-04 23:00:27 +08:00
parent 5d228b9c27
commit 080e58eeb7
2 changed files with 5 additions and 2 deletions
+4 -2
View File
@@ -135,6 +135,7 @@ impl Compressor {
}
#[test]
#[cfg(feature = "zstd_compress")]
fn test_lz4() {
use crate::protocol::extension::{CompressionAlgorithm, ExtensionTailPacket};
let lz4 = Compressor::Lz4;
@@ -166,7 +167,7 @@ fn test_lz4() {
unimplemented!()
}
},
ExtensionTailPacket::Unknown => {
_ => {
unimplemented!()
}
}
@@ -174,6 +175,7 @@ fn test_lz4() {
assert_eq!(in_packet.payload(), src_out_packet.payload())
}
#[test]
#[cfg(feature = "zstd_compress")]
fn test_zstd() {
use crate::protocol::extension::{CompressionAlgorithm, ExtensionTailPacket};
let zstd = Compressor::Zstd(22);
@@ -209,7 +211,7 @@ fn test_zstd() {
unimplemented!()
}
},
ExtensionTailPacket::Unknown => {
_ => {
unimplemented!()
}
}
+1
View File
@@ -137,6 +137,7 @@ impl<B: AsRef<[u8]>> NetPacket<B> {
}
Ok(NetPacket { data_len, buffer })
}
#[inline]
pub fn buffer(&self) -> &[u8] {
&self.buffer.as_ref()[..self.data_len]
}