pub struct ParseOptions {
pub filter: Option<Box<dyn Fn(&str, usize) -> bool + Send + Sync>>,
pub max_files: Option<usize>,
pub header_prefetch_size: Option<u64>,
pub password: Option<String>,
}async only.Expand description
Options for parsing RAR archives.
Use this struct to customize parsing behavior, including filtering, limiting results, and providing passwords for encrypted archives.
§Example
let opts = ParseOptions {
filter: Some(Box::new(|name, _| name.ends_with(".mp4"))),
max_files: Some(100),
#[cfg(feature = "crypto")]
password: Some("secret".to_string()),
};Fields§
§filter: Option<Box<dyn Fn(&str, usize) -> bool + Send + Sync>>Filter function: return true to include a file.
The function receives the file name and its index (0-based).
Only files where the filter returns true are included in results.
max_files: Option<usize>Maximum number of files to return.
Parsing stops after this many files are found. Useful for previewing large archives without parsing everything.
header_prefetch_size: Option<u64>Prefetch buffer size for header parsing (default: 32KB).
All headers in a volume are read from a single prefetched buffer of this size, minimizing I/O round-trips on slow media (e.g., HTTP range requests). Increase for archives with many files or large headers; decrease if memory is constrained.
password: Option<String>crypto only.Password for encrypted archives.
Required for archives with encrypted file data or headers.
If the password is wrong, RarError::DecryptionFailed is returned.