diff --git a/src/bufreader.rs b/src/bufreader.rs index fbe0152e3..2e212f96d 100644 --- a/src/bufreader.rs +++ b/src/bufreader.rs @@ -13,6 +13,7 @@ use std::io; use std::io::prelude::*; use std::mem; +#[derive(Debug)] pub struct BufReader { inner: R, buf: Box<[u8]>, diff --git a/src/crc.rs b/src/crc.rs index 397522269..db1728569 100644 --- a/src/crc.rs +++ b/src/crc.rs @@ -7,12 +7,14 @@ use libc; use ffi; /// The CRC calculated by a CrcReader. +#[derive(Debug)] pub struct Crc { crc: libc::c_ulong, amt: u32, } /// A wrapper around a `std::io::Read` that calculates the CRC. +#[derive(Debug)] pub struct CrcReader { inner: R, crc: Crc, diff --git a/src/deflate.rs b/src/deflate.rs index 3b4571ab1..eaa68c711 100644 --- a/src/deflate.rs +++ b/src/deflate.rs @@ -17,6 +17,7 @@ use {Compress, Decompress}; /// /// This structure implements a `Write` interface and takes a stream of /// uncompressed data, writing the compressed data to the wrapped writer. +#[derive(Debug)] pub struct EncoderWriter { inner: zio::Writer, } @@ -25,6 +26,7 @@ pub struct EncoderWriter { /// /// This structure implements a `Read` interface and will read uncompressed /// data from an underlying stream and emit a stream of compressed data. +#[derive(Debug)] pub struct EncoderReader { inner: EncoderReaderBuf>, } @@ -33,6 +35,7 @@ pub struct EncoderReader { /// /// This structure implements a `BufRead` interface and will read uncompressed /// data from an underlying stream and emit a stream of compressed data. +#[derive(Debug)] pub struct EncoderReaderBuf { obj: R, data: Compress, @@ -42,6 +45,7 @@ pub struct EncoderReaderBuf { /// /// This structure implements a `Read` interface and takes a stream of /// compressed data as input, providing the decompressed data when read from. +#[derive(Debug)] pub struct DecoderReader { inner: DecoderReaderBuf>, } @@ -50,6 +54,7 @@ pub struct DecoderReader { /// /// This structure implements a `BufRead` interface and takes a stream of /// compressed data as input, providing the decompressed data when read from. +#[derive(Debug)] pub struct DecoderReaderBuf { obj: R, data: Decompress, @@ -59,6 +64,7 @@ pub struct DecoderReaderBuf { /// /// This structure implements a `Write` and will emit a stream of decompressed /// data when fed a stream of compressed data. +#[derive(Debug)] pub struct DecoderWriter { inner: zio::Writer, } diff --git a/src/ffi.rs b/src/ffi.rs index 575effc70..fbef29053 100644 --- a/src/ffi.rs +++ b/src/ffi.rs @@ -65,6 +65,7 @@ mod imp { mem::size_of::() as c_int) } + #[derive(Debug)] pub struct StreamWrapper{ inner: Box, } @@ -105,6 +106,12 @@ mod imp { inner: mz_stream, } + impl ::std::fmt::Debug for StreamWrapper{ + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error>{ + write!(f, "StreamWrapper") + } + } + impl Default for StreamWrapper { fn default() -> StreamWrapper { StreamWrapper { diff --git a/src/gz.rs b/src/gz.rs index 2b1e9bc87..594265efe 100644 --- a/src/gz.rs +++ b/src/gz.rs @@ -29,6 +29,7 @@ static FCOMMENT: u8 = 1 << 4; /// /// This structure exposes a `Write` interface that will emit compressed data /// to the underlying writer `W`. +#[derive(Debug)] pub struct EncoderWriter { inner: zio::Writer, crc: Crc, @@ -41,6 +42,7 @@ pub struct EncoderWriter { /// This structure exposes a `Read` interface that will read uncompressed data /// from the underlying reader and expose the compressed version as a `Read` /// interface. +#[derive(Debug)] pub struct EncoderReader { inner: EncoderReaderBuf>, } @@ -50,6 +52,7 @@ pub struct EncoderReader { /// This structure exposes a `Read` interface that will read uncompressed data /// from the underlying reader and expose the compressed version as a `Read` /// interface. +#[derive(Debug)] pub struct EncoderReaderBuf { inner: deflate::EncoderReaderBuf>, header: Vec, @@ -60,6 +63,7 @@ pub struct EncoderReaderBuf { /// A builder structure to create a new gzip Encoder. /// /// This structure controls header configuration options such as the filename. +#[derive(Debug)] pub struct Builder { extra: Option>, filename: Option, @@ -71,6 +75,7 @@ pub struct Builder { /// /// This structure exposes a `Read` interface that will consume compressed /// data from the underlying reader and emit uncompressed data. +#[derive(Debug)] pub struct DecoderReader { inner: DecoderReaderBuf>, } @@ -86,6 +91,7 @@ pub struct DecoderReader { /// /// This structure exposes a `Read` interface that will consume all gzip members /// from the underlying reader and emit uncompressed data. +#[derive(Debug)] pub struct MultiDecoderReader { inner: MultiDecoderReaderBuf>, } @@ -94,6 +100,7 @@ pub struct MultiDecoderReader { /// /// This structure exposes a `Read` interface that will consume compressed /// data from the underlying reader and emit uncompressed data. +#[derive(Debug)] pub struct DecoderReaderBuf { inner: CrcReader>, header: Header, @@ -111,6 +118,7 @@ pub struct DecoderReaderBuf { /// /// This structure exposes a `Read` interface that will consume all gzip members /// from the underlying reader and emit uncompressed data. +#[derive(Debug)] pub struct MultiDecoderReaderBuf { inner: CrcReader>, header: Header, @@ -121,7 +129,7 @@ pub struct MultiDecoderReaderBuf { /// /// The header can contain metadata about the file that was compressed, if /// present. -#[derive(PartialEq)] +#[derive(PartialEq, Debug)] pub struct Header { extra: Option>, filename: Option>, diff --git a/src/mem.rs b/src/mem.rs index bc1603c20..b6f7815ee 100644 --- a/src/mem.rs +++ b/src/mem.rs @@ -18,6 +18,7 @@ use ffi; /// /// It is recommended to use the I/O stream adaptors over this type as they're /// easier to use. +#[derive(Debug)] pub struct Compress { inner: Stream, } @@ -31,10 +32,12 @@ pub struct Compress { /// /// It is recommended to use the I/O stream adaptors over this type as they're /// easier to use. +#[derive(Debug)] pub struct Decompress { inner: Stream, } +#[derive(Debug)] struct Stream { stream_wrapper: ffi::StreamWrapper, total_in: u64, @@ -49,12 +52,14 @@ trait Direction { unsafe fn destroy(stream: *mut ffi::mz_stream) -> c_int; } +#[derive(Debug)] enum DirCompress {} +#[derive(Debug)] enum DirDecompress {} /// Values which indicate the form of flushing to be used when compressing or /// decompressing in-memory data. -#[derive(Copy, Clone, PartialEq, Eq)] +#[derive(Copy, Clone, PartialEq, Eq, Debug)] pub enum Flush { /// A typical parameter for passing to compression/decompression functions, /// this indicates that the underlying stream to decide how much data to @@ -113,7 +118,7 @@ pub struct DataError(()); /// Possible status results of compressing some data or successfully /// decompressing a block of data. -#[derive(Copy, Clone, PartialEq, Eq)] +#[derive(Copy, Clone, PartialEq, Eq, Debug)] pub enum Status { /// Indicates success. /// diff --git a/src/zio.rs b/src/zio.rs index efb49f9c8..534b60fe4 100644 --- a/src/zio.rs +++ b/src/zio.rs @@ -4,6 +4,7 @@ use std::mem; use {Decompress, Compress, Status, Flush, DataError}; +#[derive(Debug)] pub struct Writer { obj: Option, pub data: D, diff --git a/src/zlib.rs b/src/zlib.rs index 8babef74d..d6289021c 100644 --- a/src/zlib.rs +++ b/src/zlib.rs @@ -17,6 +17,7 @@ use {Compress, Decompress}; /// /// This structure implements a `Write` interface and takes a stream of /// uncompressed data, writing the compressed data to the wrapped writer. +#[derive(Debug)] pub struct EncoderWriter { inner: zio::Writer, } @@ -25,6 +26,7 @@ pub struct EncoderWriter { /// /// This structure implements a `Read` interface and will read uncompressed /// data from an underlying stream and emit a stream of compressed data. +#[derive(Debug)] pub struct EncoderReader { inner: EncoderReaderBuf>, } @@ -33,6 +35,7 @@ pub struct EncoderReader { /// /// This structure implements a `BufRead` interface and will read uncompressed /// data from an underlying stream and emit a stream of compressed data. +#[derive(Debug)] pub struct EncoderReaderBuf { obj: R, data: Compress, @@ -42,6 +45,7 @@ pub struct EncoderReaderBuf { /// /// This structure implements a `Read` interface and takes a stream of /// compressed data as input, providing the decompressed data when read from. +#[derive(Debug)] pub struct DecoderReader { inner: DecoderReaderBuf>, } @@ -50,6 +54,7 @@ pub struct DecoderReader { /// /// This structure implements a `BufRead` interface and takes a stream of /// compressed data as input, providing the decompressed data when read from. +#[derive(Debug)] pub struct DecoderReaderBuf { obj: R, data: Decompress, @@ -59,6 +64,7 @@ pub struct DecoderReaderBuf { /// /// This structure implements a `Write` and will emit a stream of decompressed /// data when fed a stream of compressed data. +#[derive(Debug)] pub struct DecoderWriter { inner: zio::Writer, }