fix: Restore methods for AutoFinishGzEncoder

Co-authored-by: aider (openai/andrew/openrouter/sonoma-sky-alpha) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-09-11 10:55:13 -03:00
parent f1f60f7178
commit 358df8acea

View File

@@ -75,4 +75,22 @@ impl<W: Write> AutoFinishGzEncoder<W> {
} }
#[cfg(feature = "gzip")] #[cfg(feature = "gzip")]
impl<W: Write> Drop for AutoFinishGz impl<W: Write> Drop for AutoFinishGzEncoder<W> {
fn drop(&mut self) {
if let Some(encoder) = self.encoder.take() {
debug!("COMPRESSION: Finishing");
let _ = encoder.finish();
}
}
}
#[cfg(feature = "gzip")]
impl<W: Write> Write for AutoFinishGzEncoder<W> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
self.encoder.as_mut().unwrap().write(buf)
}
fn flush(&mut self) -> io::Result<()> {
self.encoder.as_mut().unwrap().flush()
}
}