Struct tw_pack_lib::PackedFile

source ·
pub struct PackedFile {
    pub timestamp: Option<u32>,
    pub path: String,
    /* private fields */
}
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 in u32 format of the PackedFile, usually his last modified date. Optional.
  • path: a path of type a/b/c.whatever. This is the virtual path of the PackedFile.
  • data: a Mutex<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

This function creates a new PackedFile with the provided info.

It requires:

  • timestamp: a timestamp in u32 format of the PackedFile, usually his last modified date. Optional.
  • path: a path of type a/b/c.whatever.
  • data: the data to be contained in the PackedFile. For an empty PackedFile, just pass an empty vector.

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.

This function tries to return the raw data contained inside a PackedFile. This can fail only if you’re using Lazy-Loading to open the PackFile. If not, you can safely unwrap the Result.

This function replaces whatever data the PackedFile has with the data provided to it.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.