[disclaimer: initially posted on Reddit r/rust]

unrar is a library for listing and extracting RAR archives.

Hi lemmyrs!

Almost 8 years ago, I release my first Rust crate. Today, before I leave Reddit at the end of the month due to the recent controversy, after months and years working on and off on this update, as a parting gift, I’m happy to announce the crate’s biggest release ever. This really is a milestone release that, among others, allows one to extract files directly into memory – something people have been asking forever how to do.

I’ve also completely rewritten major parts of the library and am very proud of the way things are looking right now. Utilizing the typestate pattern, the library enforces correct usage at compile time, only exposing methods when they make sense (depending on a combination of open mode and current cursor position).

Before this release, the library was hard to use and it was not possible to skip some files in the archive while, for instance, extracting others. One operation had to be chosen for all files. That has changed now. However, the drawback is that iterating archives is now a bit harder since the Iterator trait is not implemented for archives that are opened in Process mode (since it’s hard to enforce an operation at call-site). I have a few ideas how to improve this going forward but input is also always welcome.

Anyway, this sets the groundwork architecture and paves the way forward for upcoming releases where ergonomics and other improvements like error types can be the focus.

Another major focus of this release was documentation: all API items are documented now except for very few exceptions. The crate docs also features a very extensible introduction as well.

GitHub repository can be found here: https://github.com/muja/unrar.rs

Feel free to discuss / ask questions here or over on Reddit.

Thanks!

  • solrize@lemmy.ml
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    1 year ago

    Nice, I will try to take a look at this. Unrar sounds like a good candidate for RIIR, because of all the weird bugs that the C implementations have had–same for things like info-zip and gzip.

    I know of a version of zip compression written in Ada and it sounds much more trustworthy than the C version. Speed is about the same too. I don’t understand why it doesn’t get more use, other than laziness.