From 6366d459491b26281642b552b9f7e11bdfc3fbbb Mon Sep 17 00:00:00 2001 From: Chris Hennick <4961925+Pr0methean@users.noreply.github.com> Date: Tue, 11 Jun 2024 20:12:13 -0700 Subject: [PATCH] fix: Implement `Debug` for `ZipWriter` even when it's not implemented for the inner writer's type --- src/write.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/write.rs b/src/write.rs index 40f0b1c9..6ede289b 100644 --- a/src/write.rs +++ b/src/write.rs @@ -148,7 +148,6 @@ pub(crate) mod zip_writer { /// # } /// # doit().unwrap(); /// ``` - #[derive(Debug)] pub struct ZipWriter { pub(super) inner: GenericZipWriter, pub(super) files: IndexMap, ZipFileData>, @@ -158,6 +157,15 @@ pub(crate) mod zip_writer { pub(super) comment: Box<[u8]>, pub(super) flush_on_finish_file: bool, } + + impl Debug for ZipWriter { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + f.write_fmt(format_args!( + "ZipWriter {{files: {:?}, stats: {:?}, writing_to_file: {}, writing_raw: {}, comment: {:?}, flush_on_finish_file: {}}}", + self.files, self.stats, self.writing_to_file, self.writing_raw, + String::from_utf8(self.comment.to_vec()), self.flush_on_finish_file)) + } + } } #[doc(inline)] pub use self::sealed::FileOptionExtension;