Skip to main content

ParseOptions

Struct ParseOptions 

Source
pub struct ParseOptions {
    pub filter: Option<Box<dyn Fn(&str, usize) -> bool + Send + Sync>>,
    pub max_files: Option<usize>,
    pub password: Option<String>,
}
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.

§password: Option<String>

Password for encrypted archives.

Required for archives with encrypted file data or headers. If the password is wrong, RarError::DecryptionFailed is returned.

Trait Implementations§

Source§

impl Default for ParseOptions

Source§

fn default() -> ParseOptions

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.