The Encoders should have impl Drop that finishes the compressed stream upon drop(). BufWriter does something similar (flushes its buffer upon drop()).
My use case is Write trait objects. Consider the following trait object that writes compressed output to stdout...
fn make_writer_object() -> Box<Write> {
let stdout = io::stdout();
let buf_stdout = io::BufWriter::new(stdout);
let gzip = gzip::Encoder::new(buf_stdout).unwrap();
Box::new(gzip)
}
This doesn't work because the last bit of compressed data gets cut off.
The
Encoders should haveimpl Dropthat finishes the compressed stream upondrop().BufWriterdoes something similar (flushes its buffer upondrop()).My use case is
Writetrait objects. Consider the following trait object that writes compressed output tostdout...This doesn't work because the last bit of compressed data gets cut off.