调整代码
This commit is contained in:
@@ -135,6 +135,7 @@ impl Compressor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(feature = "zstd_compress")]
|
||||||
fn test_lz4() {
|
fn test_lz4() {
|
||||||
use crate::protocol::extension::{CompressionAlgorithm, ExtensionTailPacket};
|
use crate::protocol::extension::{CompressionAlgorithm, ExtensionTailPacket};
|
||||||
let lz4 = Compressor::Lz4;
|
let lz4 = Compressor::Lz4;
|
||||||
@@ -166,7 +167,7 @@ fn test_lz4() {
|
|||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ExtensionTailPacket::Unknown => {
|
_ => {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -174,6 +175,7 @@ fn test_lz4() {
|
|||||||
assert_eq!(in_packet.payload(), src_out_packet.payload())
|
assert_eq!(in_packet.payload(), src_out_packet.payload())
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(feature = "zstd_compress")]
|
||||||
fn test_zstd() {
|
fn test_zstd() {
|
||||||
use crate::protocol::extension::{CompressionAlgorithm, ExtensionTailPacket};
|
use crate::protocol::extension::{CompressionAlgorithm, ExtensionTailPacket};
|
||||||
let zstd = Compressor::Zstd(22);
|
let zstd = Compressor::Zstd(22);
|
||||||
@@ -209,7 +211,7 @@ fn test_zstd() {
|
|||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ExtensionTailPacket::Unknown => {
|
_ => {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,6 +137,7 @@ impl<B: AsRef<[u8]>> NetPacket<B> {
|
|||||||
}
|
}
|
||||||
Ok(NetPacket { data_len, buffer })
|
Ok(NetPacket { data_len, buffer })
|
||||||
}
|
}
|
||||||
|
#[inline]
|
||||||
pub fn buffer(&self) -> &[u8] {
|
pub fn buffer(&self) -> &[u8] {
|
||||||
&self.buffer.as_ref()[..self.data_len]
|
&self.buffer.as_ref()[..self.data_len]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user