Skip Navigation
Announcing unrar v0.5.0

[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!

2
Announcing unrar v0.5.0

[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!

0
Announcing unrar v0.5.0

[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!

0
Using OnceCell with Regex (for reading only)
  • First of all, thank you for this very elaborate answer. So that means OnceCell can never be used in a static but only as local variable / member variable? I see, that makes sense and also reduces its use cases by a lot of what I initially thought. But your example makes sense and the name/package also suggest it's not thread-safe in itself, I had just wrongly assumed OnceCell was meant to be used in static contexts.

    Thanks!

  • Using OnceCell with Regex (for reading only)

    I've been using lazy_static until now but was trying to migrate to OnceCell. It seems I can't have a OnceCell<Regex> even though I'm never calling mutable methods on the regex. I'm not even using multiple threads.

    The error I'm getting is:

    !

    Any way to solve this or do I have to use OnceLock / continue using lazy_static? I don't want to add the overhead of using OnceLock if not necessary.

    5
    InitialsDiceBearhttps://github.com/dicebear/dicebearhttps://creativecommons.org/publicdomain/zero/1.0/„Initials” (https://github.com/dicebear/dicebear) by „DiceBear”, licensed under „CC0 1.0” (https://creativecommons.org/publicdomain/zero/1.0/)DA
    danyel @lemmyrs.org
    Posts 4
    Comments 2