Closed efyang closed 8 years ago
Hey, thank you for this pull request! Sorry I did not get a chance to take a look at it sooner.
The reason I wasn't calling finish
in drop
is because finish
returns an error and drop
has no way to propagate that error to the library's user. It allows the user to write code that compiles and runs correctly, but which isn't actually correct, because it won't handle all error scenarios. That's not very Rust-ic I think.
Ah ok, makes sense.
Basically, this PR just forces
LzmaWriter
to callfinish
before ending the stream. This prevents any accidental corruptions and makes it much easier to write any structs that might contain it, and makes it behave a bit more like compressors in theflate2
andbzip2
libraries.