Skip to main content

DecodeableExtraData

Struct DecodeableExtraData 

Source
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 schema and optionally table_name for fragments
  • Containers (PackFiles): Use lazy_load, disk_file_path, disk_file_offset
  • Images: Use is_dds to 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>

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn timestamp(&self) -> &u64

File modification timestamp (Unix epoch seconds).

Preserved from the original file for metadata tracking.

Source

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.

Source

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.

Source

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).

Source

pub fn file_name(&self) -> &Option<&'a str>

Original filename (with extension).

Used for file type detection, logging, and error messages.

Source

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.

Source

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>

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn set_timestamp(&mut self, val: u64) -> &mut Self

File modification timestamp (Unix epoch seconds).

Preserved from the original file for metadata tracking.

Source

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.

Source

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.

Source

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).

Source

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.

Source

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.

Source

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>

Source§

fn clone(&self) -> DecodeableExtraData<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for DecodeableExtraData<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> Default for DecodeableExtraData<'a>

Source§

fn default() -> DecodeableExtraData<'a>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.