pub struct Archive<R: Read + Seek> { /* private fields */ }Expand description
Implementation of a MoPaQ archive viewer.
Refer to top-level documentation to see which features are supported.
Will work on any reader that implements Read + Seek.
Implementations§
Source§impl<R: Read + Seek> Archive<R>
impl<R: Read + Seek> Archive<R>
Sourcepub fn open(reader: R) -> Result<Archive<R>, MpqError>
pub fn open(reader: R) -> Result<Archive<R>, MpqError>
Try to open an MPQ archive from the specified reader.
Immediately, this will perform the following:
- Locate an MPQ header.
- Locate and read the Hash Table.
- Locate and read the Block Table.
If any of these steps fail, the archive is deemed corrupted and an appropriate error is returned.
No other operations will be performed.
Sourcepub fn read_file(&mut self, name: &str) -> Result<Vec<u8>, MpqError>
pub fn read_file(&mut self, name: &str) -> Result<Vec<u8>, MpqError>
Read a file’s contents.
Notably, the filename resolution algorithm
is case, and will treat backslashes (\) and forward slashes (/)
as different characters.
Does not support single-unit files or uncompressed files.
Sourcepub fn files(&mut self) -> Option<Vec<String>>
pub fn files(&mut self) -> Option<Vec<String>>
If the archive contains a (listfile), this will method
parse it and return a Vec containing all known filenames.
pub fn start(&self) -> u64
pub fn end(&self) -> u64
pub fn size(&self) -> u64
pub fn reader(&mut self) -> &mut R
Trait Implementations§
Auto Trait Implementations§
impl<R> Freeze for Archive<R>where
R: Freeze,
impl<R> RefUnwindSafe for Archive<R>where
R: RefUnwindSafe,
impl<R> Send for Archive<R>where
R: Send,
impl<R> Sync for Archive<R>where
R: Sync,
impl<R> Unpin for Archive<R>where
R: Unpin,
impl<R> UnwindSafe for Archive<R>where
R: UnwindSafe,
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
Mutably borrows from an owned value. Read more