pub struct DecodeableExtraData<'a> { /* private fields */ }Expand description
Additional context data for Decodeable::decode() operations.
This structure provides optional configuration and metadata that decoders may need to properly interpret binary data. Different file types use different subsets of these fields.
§Field Categories
- Configuration toggles: Control decoder behavior (lazy loading, encryption status, etc.)
- OnDisk-related data: File location and timestamp information
- Table-related data: Database table-specific context
- Image-related data: Image format detection flags
- General-purpose data: Game info, file names, sizes
§Usage
use rpfm_lib::files::DecodeableExtraData;
// For decoding a DB table
let extra_data = DecodeableExtraData::default()
.set_schema(Some(&schema))
.set_game_info(Some(&game_info))
.set_table_name(Some("units_tables"))
.set_return_incomplete(true);§Required Fields by Type
- DB Tables: Require
schemaand optionallytable_namefor fragments - Containers (PackFiles): Use
lazy_load,disk_file_path,disk_file_offset - Images: Use
is_ddsto enable DDS-specific decoding - Generic files: May use
game_info,file_name,data_size
For specific requirements, consult each file type’s documentation.
Implementations§
Source§impl<'a> DecodeableExtraData<'a>
impl<'a> DecodeableExtraData<'a>
Sourcepub fn lazy_load(&self) -> &bool
pub fn lazy_load(&self) -> &bool
Enable lazy loading for container files.
When true, Container implementors will defer loading file data until accessed,
storing only metadata initially. This reduces memory usage for large containers.
Sourcepub fn is_encrypted(&self) -> &bool
pub fn is_encrypted(&self) -> &bool
Indicates whether the source data was encrypted.
This is informational only - data reaching decode functions should already be decrypted. Used for metadata tracking and logging.
Sourcepub fn return_incomplete(&self) -> &bool
pub fn return_incomplete(&self) -> &bool
Allow returning partial data on decode errors (DB tables only).
When true, table decoders will return successfully decoded rows even if later
rows fail to decode. When false, any decode error fails the entire operation.
Sourcepub fn schema(&self) -> &Option<&'a Schema>
pub fn schema(&self) -> &Option<&'a Schema>
Schema definition for decoding DB tables and Loc files.
Required for decoding database tables, as the schema defines the table structure, column types, and versioning information.
Sourcepub fn disk_file_path(&self) -> &Option<&'a str>
pub fn disk_file_path(&self) -> &Option<&'a str>
Absolute path to the file on disk.
Used by lazy-loading containers to know where to read data from when needed.
Should be None for in-memory data.
Sourcepub fn disk_file_offset(&self) -> &u64
pub fn disk_file_offset(&self) -> &u64
Byte offset within the disk file where this file’s data begins.
Used for files embedded within larger containers (e.g., individual files in a PackFile).
Set to 0 for standalone files.
Sourcepub fn timestamp(&self) -> &u64
pub fn timestamp(&self) -> &u64
File modification timestamp (Unix epoch seconds).
Preserved from the original file for metadata tracking.
Sourcepub fn table_name(&self) -> &Option<&'a str>
pub fn table_name(&self) -> &Option<&'a str>
Name of the table (without extension or path).
Used when decoding table fragments that don’t have the full path context. For example, when decoding a table from a loose file or unnamed buffer.
Sourcepub fn is_dds(&self) -> &bool
pub fn is_dds(&self) -> &bool
Flag indicating the image is in DDS (DirectDraw Surface) format.
When true, enables DDS-specific decoding and conversion to PNG for display.
Sourcepub fn game_info(&self) -> &Option<&'a GameInfo>
pub fn game_info(&self) -> &Option<&'a GameInfo>
Complete game information context.
Provides game-specific settings, version info, and feature flags that may affect decoding behavior (e.g., format variations between game versions).
Sourcepub fn file_name(&self) -> &Option<&'a str>
pub fn file_name(&self) -> &Option<&'a str>
Original filename (with extension).
Used for file type detection, logging, and error messages.
Sourcepub fn data_size(&self) -> &u64
pub fn data_size(&self) -> &u64
Total size of the file data in bytes.
May differ from buffer size if dealing with partial data or compressed streams.
Sourcepub fn skip_path_cache_generation(&self) -> &bool
pub fn skip_path_cache_generation(&self) -> &bool
Skip automatic path cache generation for containers.
When true, container decoders won’t build the lowercase path cache automatically.
You must manually call Container::paths_cache_generate() after decoding or
case-insensitive lookups will fail.
This is an optimization for bulk operations where you’ll rebuild the cache once at the end instead of incrementally.
Source§impl<'a> DecodeableExtraData<'a>
impl<'a> DecodeableExtraData<'a>
Sourcepub fn set_lazy_load(&mut self, val: bool) -> &mut Self
pub fn set_lazy_load(&mut self, val: bool) -> &mut Self
Enable lazy loading for container files.
When true, Container implementors will defer loading file data until accessed,
storing only metadata initially. This reduces memory usage for large containers.
Sourcepub fn set_is_encrypted(&mut self, val: bool) -> &mut Self
pub fn set_is_encrypted(&mut self, val: bool) -> &mut Self
Indicates whether the source data was encrypted.
This is informational only - data reaching decode functions should already be decrypted. Used for metadata tracking and logging.
Sourcepub fn set_return_incomplete(&mut self, val: bool) -> &mut Self
pub fn set_return_incomplete(&mut self, val: bool) -> &mut Self
Allow returning partial data on decode errors (DB tables only).
When true, table decoders will return successfully decoded rows even if later
rows fail to decode. When false, any decode error fails the entire operation.
Sourcepub fn set_schema(&mut self, val: Option<&'a Schema>) -> &mut Self
pub fn set_schema(&mut self, val: Option<&'a Schema>) -> &mut Self
Schema definition for decoding DB tables and Loc files.
Required for decoding database tables, as the schema defines the table structure, column types, and versioning information.
Sourcepub fn set_disk_file_path(&mut self, val: Option<&'a str>) -> &mut Self
pub fn set_disk_file_path(&mut self, val: Option<&'a str>) -> &mut Self
Absolute path to the file on disk.
Used by lazy-loading containers to know where to read data from when needed.
Should be None for in-memory data.
Sourcepub fn set_disk_file_offset(&mut self, val: u64) -> &mut Self
pub fn set_disk_file_offset(&mut self, val: u64) -> &mut Self
Byte offset within the disk file where this file’s data begins.
Used for files embedded within larger containers (e.g., individual files in a PackFile).
Set to 0 for standalone files.
Sourcepub fn set_timestamp(&mut self, val: u64) -> &mut Self
pub fn set_timestamp(&mut self, val: u64) -> &mut Self
File modification timestamp (Unix epoch seconds).
Preserved from the original file for metadata tracking.
Sourcepub fn set_table_name(&mut self, val: Option<&'a str>) -> &mut Self
pub fn set_table_name(&mut self, val: Option<&'a str>) -> &mut Self
Name of the table (without extension or path).
Used when decoding table fragments that don’t have the full path context. For example, when decoding a table from a loose file or unnamed buffer.
Sourcepub fn set_is_dds(&mut self, val: bool) -> &mut Self
pub fn set_is_dds(&mut self, val: bool) -> &mut Self
Flag indicating the image is in DDS (DirectDraw Surface) format.
When true, enables DDS-specific decoding and conversion to PNG for display.
Sourcepub fn set_game_info(&mut self, val: Option<&'a GameInfo>) -> &mut Self
pub fn set_game_info(&mut self, val: Option<&'a GameInfo>) -> &mut Self
Complete game information context.
Provides game-specific settings, version info, and feature flags that may affect decoding behavior (e.g., format variations between game versions).
Sourcepub fn set_file_name(&mut self, val: Option<&'a str>) -> &mut Self
pub fn set_file_name(&mut self, val: Option<&'a str>) -> &mut Self
Original filename (with extension).
Used for file type detection, logging, and error messages.
Sourcepub fn set_data_size(&mut self, val: u64) -> &mut Self
pub fn set_data_size(&mut self, val: u64) -> &mut Self
Total size of the file data in bytes.
May differ from buffer size if dealing with partial data or compressed streams.
Sourcepub fn set_skip_path_cache_generation(&mut self, val: bool) -> &mut Self
pub fn set_skip_path_cache_generation(&mut self, val: bool) -> &mut Self
Skip automatic path cache generation for containers.
When true, container decoders won’t build the lowercase path cache automatically.
You must manually call Container::paths_cache_generate() after decoding or
case-insensitive lookups will fail.
This is an optimization for bulk operations where you’ll rebuild the cache once at the end instead of incrementally.
Trait Implementations§
Source§impl<'a> Clone for DecodeableExtraData<'a>
impl<'a> Clone for DecodeableExtraData<'a>
Source§fn clone(&self) -> DecodeableExtraData<'a>
fn clone(&self) -> DecodeableExtraData<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a> Debug for DecodeableExtraData<'a>
impl<'a> Debug for DecodeableExtraData<'a>
Source§impl<'a> Default for DecodeableExtraData<'a>
impl<'a> Default for DecodeableExtraData<'a>
Source§fn default() -> DecodeableExtraData<'a>
fn default() -> DecodeableExtraData<'a>
Auto Trait Implementations§
impl<'a> Freeze for DecodeableExtraData<'a>
impl<'a> RefUnwindSafe for DecodeableExtraData<'a>
impl<'a> Send for DecodeableExtraData<'a>
impl<'a> Sync for DecodeableExtraData<'a>
impl<'a> Unpin for DecodeableExtraData<'a>
impl<'a> UnsafeUnpin for DecodeableExtraData<'a>
impl<'a> UnwindSafe for DecodeableExtraData<'a>
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§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.