Skip to content

Commit d3e15ff

Browse files
committed
feat(decompression-plz): changed main decompression function to accept mutable reference of DecompressTrait
1 parent 4486dc7 commit d3e15ff

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

decompression-plz/src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ pub use dtraits::DecompressTrait;
1111
mod state;
1212

1313
pub fn decompress<T>(
14-
mut message: T,
14+
message: &mut T,
1515
extra_body: Option<BytesMut>,
1616
buf: &mut BytesMut,
1717
)
1818
//-> Result<(), MultiDecompressError>
1919
where
2020
T: DecompressTrait,
2121
{
22-
let mut state = DecodeState::init(&mut message, extra_body, buf);
22+
let mut state = DecodeState::init(message, extra_body, buf);
2323
loop {
2424
state = state.try_next();
2525
if state.is_ended() {
@@ -33,11 +33,13 @@ where
3333
// helper function for tests
3434
#[cfg(test)]
3535
pub mod tests {
36+
use bytes::BytesMut;
3637
use flate2::Compression;
3738
use header_plz::body_headers::{
3839
content_encoding::ContentEncoding, encoding_info::EncodingInfo,
3940
};
4041
use std::io::Write;
42+
4143
pub const INPUT: &[u8] = b"hello world";
4244

4345
pub fn all_compressed_data() -> Vec<u8> {

0 commit comments

Comments
 (0)