feat(writer): Allow getting underlying writer of ZipWriter#464
feat(writer): Allow getting underlying writer of ZipWriter#464Pr0methean merged 9 commits intozip-rs:masterfrom
Conversation
|
I just noticed this PR was created, so I've just published a new |
|
/q Fix the build errors in this PR. |
|
I'm unable to access the file contents in this PR to diagnose the specific build errors. To help fix the build errors, I would need:
Based on the PR description and comments, the likely issues are:
Could you please:
Alternatively, if you can run |
|
/q Fix the build errors in this PR. |
|
I'm unable to access the file contents and specific build error messages needed to fix the build errors. To properly fix the build errors, I need either:
Could you please share:
Common issues in PRs like this that add get_ref/get_mut methods typically include:
Once I can see the specific error messages, I'll be able to provide targeted fixes. |
|
@roblabla The AI seems to be stuck in a loop trying to fix this PR: every attempted fix breaks the build, and every fix for the build errors reintroduces the bug. |
|
Also I think |
Signed-off-by: Chris Hennick <4961925+Pr0methean@users.noreply.github.com>
…from get_ref and get_mut
0ee631a to
9644d9a
Compare
|
Changed it to return an Option, since Zopfli makes the underlying writer inaccessible anyway (and making it accessible wouldn't make sense, since it's wrapped in a BitwiseWriter that may be buffering part of a byte). |
|
For what it’s worth, Zopfli does allow access to the underlying writer in its latest release, which includes zopfli-rs/zopfli#69. However, you need to call diff --git a/src/write.rs b/src/write.rs
index fbb0a736..39323105 100644
--- a/src/write.rs
+++ b/src/write.rs
@@ -200,9 +206,9 @@ pub(crate) mod zip_writer {
#[cfg(feature = "deflate-flate2")]
Deflater(w) => Some(w.get_ref().get_ref()),
#[cfg(feature = "deflate-zopfli")]
- ZopfliDeflater(_) => None,
+ ZopfliDeflater(w) => Some(w.get_ref().get_ref()),
#[cfg(feature = "deflate-zopfli")]
- BufferedZopfliDeflater(_) => None,
+ BufferedZopfliDeflater(w) => Some(w.get_ref().get_ref().get_ref()),
#[cfg(feature = "bzip2")]
Bzip2(w) => Some(w.get_ref().get_ref()),
#[cfg(feature = "zstd")]
@@ -226,9 +232,9 @@ pub(crate) mod zip_writer {
#[cfg(feature = "deflate-flate2")]
Deflater(w) => Some(w.get_mut().get_mut()),
#[cfg(feature = "deflate-zopfli")]
- ZopfliDeflater(_) => None,
+ ZopfliDeflater(w) => Some(w.get_mut().get_mut()),
#[cfg(feature = "deflate-zopfli")]
- BufferedZopfliDeflater(_) => None,
+ BufferedZopfliDeflater(w) => Some(w.get_mut().get_mut().get_mut()),
#[cfg(feature = "bzip2")]
Bzip2(w) => Some(w.get_mut().get_mut()),
#[cfg(feature = "zstd")]Of course, the caveats about the |
These allow accessing the underlying writer, which can be useful to read out the underlying state, for instance to send it out.
In my case, I need to zip chunks to a Vec, that will be periodically (after X writes) be sent out to the network and replaced. We have to work this way due to API constraints.
Most of the compression crates out there already offer support for getting the underlying writer (bzip2, zstd, flate2).
Note: this depends on: