alexcrichton / xz2-rs

Bindings to liblzma in Rust (xz streams in Rust)
Apache License 2.0
81 stars 52 forks source link

Made ErrorKind for std::io::Error more specific #80

Closed Caellian closed 3 years ago

Caellian commented 3 years ago

This helps with fallbacks (don't decompress, return compressed) and allows better error recovery for programs using xz2.

I'm not 100% sure if all ErrorKinds are appropriate as I have never worked with liblzma. Let me know if some changes need to be made.

I also added more descriptive error display strings so that crashes give more insight into why they happened.

Caellian commented 3 years ago

Right, LMK which error gets thrown when output buffer is too small (or whether that happens at all), that one needs to change to ErrorKind::WriteZero

alexcrichton commented 3 years ago

Seems reasonable to me, thanks! I think this needs rustfmt from CI but otherwise seems good to go.

alexcrichton commented 3 years ago

Thanks!