De.rust.zelve.rar
Download File ===== https://bltlly.com/2twlqm
How to Use De.rust.zelve.rar to Extract RAR Files in Rust
RAR files are compressed archives that can hold one or more files and folders inside them. They are often used to reduce the size of files for faster downloading or sharing. However, opening RAR files requires special software that can extract the contents of the archive.
De.rust.zelve.rar is a Rust library that provides a high-level wrapper around the unrar C library from rarlab. It allows you to list, extract and test RAR archives in your Rust programs. In this article, we will show you how to use De.rust.zelve.rar to work with RAR files in Rust.
Installing De.rust.zelve.rar
To use De.rust.zelve.rar, you need to add it as a dependency in your Cargo.toml file:
[dependencies]
unrar = "0.4"
This will also download and compile the unrar C library as a static library and link it to your Rust project.
Listing Archive Entries
To list the entries of a RAR archive, you need to create an Archive object with the path to the archive file and then call the list method on it. This will return an iterator over Result objects that contain information about each entry, such as name, size, attributes, etc. For example:
extern crate unrar;
use std::io::Result;
fn main() -> Result {
// Create an Archive object with the path to the archive file
let mut archive = unrar::Archive::new("De.rust.zelve.rar".into());
// List the entries of the archive
for entry in archive.list()? {
// Print the name and size of each entry
let entry = entry?;
println!("{} ({} bytes)", entry.name(), entry.size());
}
Ok(())
}
This will print something like:
README.md (123 bytes)
src/lib.rs (456 bytes)
examples/basic_list.rs (789 bytes)
Extracting Archive Contents
To extract the contents of a RAR archive, you need to create an Archive object with the path to the archive file and then call the extract method on it. This will extract all the files and folders from the archive to a destination path that you specify. For example:
extern crate unrar;
use std::io::Result;
fn main() -> Result {
// Create an Archive object with the path to the archive file
let mut archive = unrar::Archive::new("De.rust.zelve.rar".into());
// Extract all the files and folders from the archive to a destination path
archive.extract("output")?;
Ok(())
}
This will create an output folder and extract all the files and folders from De.rust.zelve.rar into it.
Testing Archive Integrity
To test the integrity of a RAR archive, you need to create an Archive object with the path to the archive file and then call the test method on it. This will check if the archive is valid and if all the files and folders inside it can be extracted without errors. For example:
extern crate unrar;
use std::io::Result;
fn main() -> Result {
// Create an Archive object with the path to the archive file
let mut archive = unrar::Archive::new("De.rust.zelve.rar".into());
// Test if the archive is valid and can be extracted without errors
archive.test()?;
println!("Archive is OK");
Ok(())
}
This will print "Archive is OK" if there are no problems with De.rust.zelve.rar.
Conclusion
In this article, we have shown you how to use De.rust.zelve.rar to list, extract and test RAR archives in Rust. De.rust.zelve.rar is a convenient and easy-to-use library that wraps around the unrar C library from rarlab. It can handle multipart files, encrypted archives with passwords, and linked statically against your aa16f39245