Skip to main content

rars_format/
lib.rs

1//! Version-specific RAR archive format support.
2//!
3//! This crate contains the wire-format parsers, writers, recovery handling, and
4//! extraction orchestration used by the high-level `rars` facade. It keeps the
5//! concrete RAR families separate so callers can inspect format-specific header
6//! fields when they need that fidelity.
7
8pub mod detect;
9pub mod error;
10pub mod features;
11pub mod rar13;
12pub mod rar15_40;
13pub mod rar50;
14pub mod version;
15
16mod io_util;
17mod source;
18mod volume_extract;
19mod x86_filter_scan;
20
21pub use detect::{detect_archive_family, find_archive_start, ArchiveSignature};
22pub use error::{Error, Result};
23pub use features::FeatureSet;
24pub use version::{ArchiveFamily, ArchiveVersion};
25
26#[derive(Debug, Clone, Copy, Default)]
27#[non_exhaustive]
28/// Options used while parsing or extracting archives.
29pub struct ArchiveReadOptions<'a> {
30    /// Password bytes used for encrypted headers or payloads.
31    pub password: Option<&'a [u8]>,
32}
33
34impl<'a> ArchiveReadOptions<'a> {
35    /// Creates read options without a password.
36    pub fn new() -> Self {
37        Self::default()
38    }
39
40    /// Creates read options with a password.
41    pub fn with_password(password: &'a [u8]) -> Self {
42        Self {
43            password: Some(password),
44        }
45    }
46}