pub struct OpenOptions {
pub load_tables: bool,
/* private fields */
}Expand description
Options for opening MPQ archives
This struct provides configuration options for how MPQ archives are opened and initialized. It follows the builder pattern for easy configuration.
§Examples
use wow_mpq::{Archive, OpenOptions};
// Open with default options
let archive = Archive::open("data.mpq")?;
// Open with custom options
let archive = OpenOptions::new()
.load_tables(false) // Defer table loading for faster startup
.open("data.mpq")?;Fields§
§load_tables: boolWhether to load and parse all tables immediately when opening the archive.
When true (default), all tables (hash, block, HET/BET) are loaded and
validated during archive opening. This provides immediate error detection
but slower startup for large archives.
When false, tables are loaded on-demand when first accessed. This
provides faster startup but may defer error detection.
Implementations§
Source§impl OpenOptions
impl OpenOptions
Sourcepub fn new() -> Self
pub fn new() -> Self
Create new default options
Returns an OpenOptions instance with default settings:
load_tables = true(immediate table loading)version = None(defaults to MPQ v1 for new archives)
Sourcepub fn load_tables(self, load: bool) -> Self
pub fn load_tables(self, load: bool) -> Self
Sourcepub fn version(self, version: FormatVersion) -> Self
pub fn version(self, version: FormatVersion) -> Self
Sourcepub fn open<P: AsRef<Path>>(self, path: P) -> Result<Archive>
pub fn open<P: AsRef<Path>>(self, path: P) -> Result<Archive>
Open an existing MPQ archive with these options
§Parameters
path: Path to the MPQ archive file
§Returns
Ok(Archive) on success, Err(Error) on failure
§Errors
Error::Ioif the file cannot be openedError::InvalidFormatif the file is not a valid MPQ archiveError::Corruptionif table validation fails (whenload_tables = true)
Sourcepub fn create<P: AsRef<Path>>(self, path: P) -> Result<Archive>
pub fn create<P: AsRef<Path>>(self, path: P) -> Result<Archive>
Create a new empty MPQ archive with these options
Creates a new MPQ archive file with the specified format version. The archive will be empty but properly formatted.
§Parameters
path: Path where the new archive should be created
§Returns
Ok(Archive) on success, Err(Error) on failure
§Errors
Error::Ioif the file cannot be createdError::InvalidFormatif archive creation fails
Trait Implementations§
Source§impl Clone for OpenOptions
impl Clone for OpenOptions
Source§fn clone(&self) -> OpenOptions
fn clone(&self) -> OpenOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OpenOptions
impl Debug for OpenOptions
Auto Trait Implementations§
impl Freeze for OpenOptions
impl RefUnwindSafe for OpenOptions
impl Send for OpenOptions
impl Sync for OpenOptions
impl Unpin for OpenOptions
impl UnwindSafe for OpenOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more