diff options
-rw-r--r-- | buffered-reader/src/adapter.rs | 9 | ||||
-rw-r--r-- | buffered-reader/src/decompress_bzip2.rs | 9 | ||||
-rw-r--r-- | buffered-reader/src/decompress_deflate.rs | 9 | ||||
-rw-r--r-- | buffered-reader/src/dup.rs | 10 | ||||
-rw-r--r-- | buffered-reader/src/eof.rs | 8 | ||||
-rw-r--r-- | buffered-reader/src/limitor.rs | 10 | ||||
-rw-r--r-- | buffered-reader/src/memory.rs | 10 | ||||
-rw-r--r-- | buffered-reader/src/reserve.rs | 10 |
8 files changed, 8 insertions, 67 deletions
diff --git a/buffered-reader/src/adapter.rs b/buffered-reader/src/adapter.rs index 59a85dd2..7b620a2b 100644 --- a/buffered-reader/src/adapter.rs +++ b/buffered-reader/src/adapter.rs @@ -9,6 +9,7 @@ use super::*; /// Generic::with_cookie(b, _)`, but that introduces buffering. This /// `Adapter` also changes cookie types, but does no buffering of its /// own. +#[derive(Debug)] pub struct Adapter<T: BufferedReader<B>, B: fmt::Debug, C: fmt::Debug> { reader: T, _ghostly_cookie: std::marker::PhantomData<B>, @@ -21,14 +22,6 @@ impl<T: BufferedReader<B>, B: fmt::Debug, C: fmt::Debug> fmt::Display for Adapte } } -impl<T: BufferedReader<B>, B: fmt::Debug, C: fmt::Debug> fmt::Debug for Adapter<T, B, C> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("Adapter") - .field("reader", &self.reader) - .finish() - } -} - impl<T: BufferedReader<B>, B: fmt::Debug> Adapter<T, B, ()> { /// Instantiates a new adapter. /// diff --git a/buffered-reader/src/decompress_bzip2.rs b/buffered-reader/src/decompress_bzip2.rs index eca9800c..c0c60653 100644 --- a/buffered-reader/src/decompress_bzip2.rs +++ b/buffered-reader/src/decompress_bzip2.rs @@ -8,6 +8,7 @@ use super::*; /// Decompresses the underlying `BufferedReader` using the bzip2 /// algorithm. +#[derive(Debug)] pub struct Bzip<R: BufferedReader<C>, C: fmt::Debug> { reader: Generic<BzDecoder<R>, C>, } @@ -40,14 +41,6 @@ impl<R: BufferedReader<C>, C: fmt::Debug> io::Read for Bzip<R, C> { } } -impl<R: BufferedReader<C>, C: fmt::Debug> fmt::Debug for Bzip<R, C> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("Bzip") - .field("reader", &self.get_ref().unwrap()) - .finish() - } -} - impl<R: BufferedReader<C>, C: fmt::Debug> fmt::Display for Bzip<R, C> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("Bzip").finish() diff --git a/buffered-reader/src/decompress_deflate.rs b/buffered-reader/src/decompress_deflate.rs index 89ebeabe..6d8af629 100644 --- a/buffered-reader/src/decompress_deflate.rs +++ b/buffered-reader/src/decompress_deflate.rs @@ -8,6 +8,7 @@ use super::*; /// Decompresses the underlying `BufferedReader` using the deflate /// algorithm. +#[derive(Debug)] pub struct Deflate<R: BufferedReader<C>, C: fmt::Debug> { reader: Generic<DeflateDecoder<R>, C>, } @@ -46,14 +47,6 @@ impl<R: BufferedReader<C>, C: fmt::Debug> fmt::Display for Deflate<R, C> { } } -impl<R: BufferedReader<C>, C: fmt::Debug> fmt::Debug for Deflate<R, C> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("Deflate") - .field("reader", &self.get_ref().unwrap()) - .finish() - } -} - impl<R: BufferedReader<C>, C: fmt::Debug> BufferedReader<C> for Deflate<R, C> { fn buffer(&self) -> &[u8] { diff --git a/buffered-reader/src/dup.rs b/buffered-reader/src/dup.rs index 6cb6c70f..afca4296 100644 --- a/buffered-reader/src/dup.rs +++ b/buffered-reader/src/dup.rs @@ -10,6 +10,7 @@ use super::*; /// Note: this will likely cause the underlying stream to buffer as /// much data as you read. Thus, it should only be used for peeking /// at the underlying `BufferedReader`. +#[derive(Debug)] pub struct Dup<T: BufferedReader<C>, C: fmt::Debug> { reader: T, @@ -28,15 +29,6 @@ impl<T: BufferedReader<C>, C: fmt::Debug> fmt::Display for Dup<T, C> { } } -impl<T: BufferedReader<C>, C: fmt::Debug> fmt::Debug for Dup<T, C> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("Dup") - .field("cursor", &self.cursor) - .field("reader", &self.reader) - .finish() - } -} - impl<T: BufferedReader<()>> Dup<T, ()> { /// Instantiates a new `Dup` buffered reader. /// diff --git a/buffered-reader/src/eof.rs b/buffered-reader/src/eof.rs index b2db3ec7..7f36e074 100644 --- a/buffered-reader/src/eof.rs +++ b/buffered-reader/src/eof.rs @@ -5,6 +5,7 @@ use std::fmt; use crate::BufferedReader; /// Always returns EOF. +#[derive(Debug)] pub struct EOF<C> { cookie: C, } @@ -16,13 +17,6 @@ impl<C> fmt::Display for EOF<C> { } } -impl<C> fmt::Debug for EOF<C> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("EOF") - .finish() - } -} - impl EOF<()> { /// Instantiates a new `EOF`. pub fn new() -> Self { diff --git a/buffered-reader/src/limitor.rs b/buffered-reader/src/limitor.rs index 619c8d3e..369c9f11 100644 --- a/buffered-reader/src/limitor.rs +++ b/buffered-reader/src/limitor.rs @@ -5,6 +5,7 @@ use super::*; /// Limits the amount of data that can be read from a /// `BufferedReader`. +#[derive(Debug)] pub struct Limitor<T: BufferedReader<C>, C: fmt::Debug> { reader: T, limit: u64, @@ -20,15 +21,6 @@ impl<T: BufferedReader<C>, C: fmt::Debug> fmt::Display for Limitor<T, C> { } } -impl<T: BufferedReader<C>, C: fmt::Debug> fmt::Debug for Limitor<T, C> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("Limitor") - .field("limit", &self.limit) - .field("reader", &self.reader) - .finish() - } -} - impl<T: BufferedReader<()>> Limitor<T, ()> { /// Instantiates a new limitor. /// diff --git a/buffered-reader/src/memory.rs b/buffered-reader/src/memory.rs index 565cd4c5..b09a3478 100644 --- a/buffered-reader/src/memory.rs +++ b/buffered-reader/src/memory.rs @@ -11,6 +11,7 @@ use super::*; /// Although it is possible to use `Generic` to wrap a /// buffer, this implementation is optimized for a memory buffer, and /// avoids double buffering. +#[derive(Debug)] pub struct Memory<'a, C: fmt::Debug> { buffer: &'a [u8], // The next byte to read in the buffer. @@ -27,15 +28,6 @@ impl<'a, C: fmt::Debug> fmt::Display for Memory<'a, C> { } } -impl<'a, C: fmt::Debug> fmt::Debug for Memory<'a, C> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("Memory") - .field("buffer (bytes)", &&self.buffer.len()) - .field("cursor", &self.cursor) - .finish() - } -} - impl<'a> Memory<'a, ()> { /// Instantiates a new `Memory`. /// diff --git a/buffered-reader/src/reserve.rs b/buffered-reader/src/reserve.rs index 37f3ea0d..9d3d755f 100644 --- a/buffered-reader/src/reserve.rs +++ b/buffered-reader/src/reserve.rs @@ -9,6 +9,7 @@ use super::*; /// Note: because the `Reserve` doesn't generally know /// how much data can be read from the underlying `BufferedReader`, /// it causes at least N bytes to by buffered. +#[derive(Debug)] pub struct Reserve<T: BufferedReader<C>, C: fmt::Debug> { reader: T, reserve: usize, @@ -24,15 +25,6 @@ impl<T: BufferedReader<C>, C: fmt::Debug> fmt::Display for Reserve<T, C> { } } -impl<T: BufferedReader<C>, C: fmt::Debug> fmt::Debug for Reserve<T, C> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("Reserve") - .field("reserve", &self.reserve) - .field("reader", &self.reader) - .finish() - } -} - impl<T: BufferedReader<()>> Reserve<T, ()> { /// Instantiates a new `Reserve`. /// |