Struct tw_pack_lib::PackedFile
source · Expand description
This struct represents a PackedFile, a File contained inside a PackFile.
A PackedFile is a File contained inside a PackFile. It contains:
timestamp
: a timestamp inu32
format of the PackedFile, usually hislast modified
date. Optional.path
: a path of typea/b/c.whatever
. This is the virtual path of the PackedFile.data
: aMutex<PackedFileData>
with the data to be contained in the PackedFile. Private. If you want to get/set it, use the dedicated methods.
Keep in mind that other than decrypting the data if it’s encrypted, the PackedFiles data is stored as it’s in the PackFile. If you want to decode it/process it/edit it in any way, use an specialized program like RPFM, or write your own code for it.
Fields
timestamp: Option<u32>
path: String
Implementations
sourceimpl PackedFile
impl PackedFile
sourcepub fn new(timestamp: Option<u32>, path: String, data: Vec<u8>) -> Self
pub fn new(timestamp: Option<u32>, path: String, data: Vec<u8>) -> Self
This function creates a new PackedFile with the provided info.
It requires:
timestamp
: a timestamp inu32
format of the PackedFile, usually hislast modified
date. Optional.path
: a path of typea/b/c.whatever
.data
: the data to be contained in the PackedFile. For an empty PackedFile, just pass an empty vector.
sourcepub fn load_data(&self) -> Result<()>
pub fn load_data(&self) -> Result<()>
This function tries to load the data from a PackedFile to memory, if it’s not yet loaded. Useful for situations when we just want to “disable” the Lazy Loading, or for when we need all the stuff loaded in memory for whatever reason.
Trait Implementations
sourceimpl Clone for PackedFile
impl Clone for PackedFile
sourceimpl Debug for PackedFile
impl Debug for PackedFile
Auto Trait Implementations
impl RefUnwindSafe for PackedFile
impl Send for PackedFile
impl Sync for PackedFile
impl Unpin for PackedFile
impl UnwindSafe for PackedFile
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more