2626}
2727
2828/// Hold all state needed for compressing data.
29- pub struct Compress ( Box < libz_rs_sys:: z_stream > ) ;
29+ pub struct Compress ( libz_rs_sys:: z_stream ) ;
3030
3131unsafe impl Sync for Compress { }
3232unsafe impl Send for Compress { }
@@ -50,11 +50,11 @@ impl Compress {
5050
5151 /// Create a new instance - this allocates so should be done with care.
5252 pub fn new ( ) -> Self {
53- let mut this = Box :: new ( libz_rs_sys:: z_stream:: default ( ) ) ;
53+ let mut this = libz_rs_sys:: z_stream:: default ( ) ;
5454
5555 unsafe {
5656 libz_rs_sys:: deflateInit_ (
57- & mut * this,
57+ & mut this,
5858 libz_rs_sys:: Z_BEST_SPEED ,
5959 libz_rs_sys:: zlibVersion ( ) ,
6060 core:: mem:: size_of :: < libz_rs_sys:: z_stream > ( ) as core:: ffi:: c_int ,
@@ -66,7 +66,7 @@ impl Compress {
6666
6767 /// Prepare the instance for a new stream.
6868 pub fn reset ( & mut self ) {
69- unsafe { libz_rs_sys:: deflateReset ( & mut * self . 0 ) } ;
69+ unsafe { libz_rs_sys:: deflateReset ( & mut self . 0 ) } ;
7070 }
7171
7272 /// Compress `input` and write compressed bytes to `output`, with `flush` controlling additional characteristics.
@@ -77,7 +77,7 @@ impl Compress {
7777 self . 0 . next_in = input. as_ptr ( ) ;
7878 self . 0 . next_out = output. as_mut_ptr ( ) ;
7979
80- match unsafe { libz_rs_sys:: deflate ( & mut * self . 0 , flush as _ ) } {
80+ match unsafe { libz_rs_sys:: deflate ( & mut self . 0 , flush as _ ) } {
8181 libz_rs_sys:: Z_OK => Ok ( Status :: Ok ) ,
8282 libz_rs_sys:: Z_BUF_ERROR => Ok ( Status :: BufError ) ,
8383 libz_rs_sys:: Z_STREAM_END => Ok ( Status :: StreamEnd ) ,
@@ -91,7 +91,7 @@ impl Compress {
9191
9292impl Drop for Compress {
9393 fn drop ( & mut self ) {
94- unsafe { libz_rs_sys:: deflateEnd ( & mut * self . 0 ) } ;
94+ unsafe { libz_rs_sys:: deflateEnd ( & mut self . 0 ) } ;
9595 }
9696}
9797
0 commit comments