chore: Bug fixes for debug implementation

This commit is contained in:
Chris Hennick 2024-05-27 17:18:31 -07:00
parent 8d81cbc2c3
commit 0c7b0080f3
No known key found for this signature in database
GPG key ID: DA47AABA4961C509

View file

@ -59,6 +59,7 @@ impl<W> Debug for MaybeEncrypted<W> {
// Don't print W, since it may be a huge Vec<u8> // Don't print W, since it may be a huge Vec<u8>
f.write_str(match self { f.write_str(match self {
MaybeEncrypted::Unencrypted(_) => "Unencrypted", MaybeEncrypted::Unencrypted(_) => "Unencrypted",
#[cfg(feature = "aes-crypto")]
MaybeEncrypted::Aes(_) => "AES", MaybeEncrypted::Aes(_) => "AES",
MaybeEncrypted::ZipCrypto(_) => "ZipCrypto" MaybeEncrypted::ZipCrypto(_) => "ZipCrypto"
}) })
@ -87,11 +88,7 @@ impl<W: Write> Write for MaybeEncrypted<W> {
enum GenericZipWriter<W: Write + Seek> { enum GenericZipWriter<W: Write + Seek> {
Closed, Closed,
Storer(MaybeEncrypted<W>), Storer(MaybeEncrypted<W>),
#[cfg(any( #[cfg(feature = "deflate-flate2")]
feature = "deflate",
feature = "deflate-zlib",
feature = "deflate-zlib-ng"
))]
Deflater(DeflateEncoder<MaybeEncrypted<W>>), Deflater(DeflateEncoder<MaybeEncrypted<W>>),
#[cfg(feature = "deflate-zopfli")] #[cfg(feature = "deflate-zopfli")]
ZopfliDeflater(zopfli::DeflateEncoder<MaybeEncrypted<W>>), ZopfliDeflater(zopfli::DeflateEncoder<MaybeEncrypted<W>>),
@ -108,11 +105,16 @@ impl <W: Write + Seek> Debug for GenericZipWriter<W> {
match self { match self {
Closed => f.write_str("Closed"), Closed => f.write_str("Closed"),
Storer(w) => f.write_fmt(format_args!("Storer({:?})", w)), Storer(w) => f.write_fmt(format_args!("Storer({:?})", w)),
GenericZipWriter::Deflater(_) => f.write_str("Deflater"), #[cfg(feature = "deflate-flate2")]
GenericZipWriter::Deflater(w) => f.write_fmt(format_args!("Deflater({:?})", w.get_ref())),
#[cfg(feature = "deflate-zopfli")]
GenericZipWriter::ZopfliDeflater(_) => f.write_str("ZopfliDeflater"), GenericZipWriter::ZopfliDeflater(_) => f.write_str("ZopfliDeflater"),
#[cfg(feature = "deflate-zopfli")]
GenericZipWriter::BufferedZopfliDeflater(_) => f.write_str("BufferedZopfliDeflater"), GenericZipWriter::BufferedZopfliDeflater(_) => f.write_str("BufferedZopfliDeflater"),
GenericZipWriter::Bzip2(_) => f.write_str("Bzip2"), #[cfg(feature = "bzip2")]
GenericZipWriter::Zstd(_) => f.write_str("Zstd"), GenericZipWriter::Bzip2(w) => f.write_fmt(format_args!("Bzip2({:?})", w.get_ref())),
#[cfg(feature = "zstd")]
GenericZipWriter::Zstd(w) => f.write_fmt(format_args!("Zstd({:?})", w.get_ref())),
} }
} }
} }