pub trait Optimizable {
// Required method
fn optimize(
&mut self,
dependencies: &mut Dependencies,
container: Option<&BTreeMap<String, Pack>>,
options: &OptimizerOptions,
) -> bool;
}Expand description
Trait for file types that can be optimized to reduce size.
Implementors define how their specific file format should be cleaned up and what constitutes an “empty” state that allows safe deletion.
Required Methods§
Sourcefn optimize(
&mut self,
dependencies: &mut Dependencies,
container: Option<&BTreeMap<String, Pack>>,
options: &OptimizerOptions,
) -> bool
fn optimize( &mut self, dependencies: &mut Dependencies, container: Option<&BTreeMap<String, Pack>>, options: &OptimizerOptions, ) -> bool
Optimizes this file to reduce size and improve compatibility.
§Arguments
dependencies- Dependencies cache for comparing against vanilla datacontainer- Optional reference to the containing pack for cross-file operationsoptions- Configuration controlling which optimizations to apply
§Returns
true if the file is now empty and can be safely deleted, false otherwise.
Implementations on Foreign Types§
Source§impl Optimizable for DB
impl Optimizable for DB
Source§fn optimize(
&mut self,
dependencies: &mut Dependencies,
container: Option<&BTreeMap<String, Pack>>,
options: &OptimizerOptions,
) -> bool
fn optimize( &mut self, dependencies: &mut Dependencies, container: Option<&BTreeMap<String, Pack>>, options: &OptimizerOptions, ) -> bool
This function optimizes the provided DB file in order to make it smaller and more compatible.
Specifically, it performs the following optimizations:
- Removal of duplicated entries.
- Removal of ITM (Identical To Master) entries.
- Removal of ITNR (Identical To New Row) entries.
It returns if the DB is empty, meaning it can be safetly deleted.
Source§impl Optimizable for Loc
impl Optimizable for Loc
Source§fn optimize(
&mut self,
dependencies: &mut Dependencies,
_container: Option<&BTreeMap<String, Pack>>,
options: &OptimizerOptions,
) -> bool
fn optimize( &mut self, dependencies: &mut Dependencies, _container: Option<&BTreeMap<String, Pack>>, options: &OptimizerOptions, ) -> bool
This function optimizes the provided Loc file in order to make it smaller and more compatible.
Specifically, it performs the following optimizations:
- Removal of duplicated entries.
- Removal of ITM (Identical To Master) entries.
- Removal of ITNR (Identical To New Row) entries.
It returns if the Loc is empty, meaning it can be safetly deleted.
Source§impl Optimizable for PortraitSettings
impl Optimizable for PortraitSettings
Source§fn optimize(
&mut self,
dependencies: &mut Dependencies,
container: Option<&BTreeMap<String, Pack>>,
options: &OptimizerOptions,
) -> bool
fn optimize( &mut self, dependencies: &mut Dependencies, container: Option<&BTreeMap<String, Pack>>, options: &OptimizerOptions, ) -> bool
This function optimizes the provided PortraitSettings file in order to make it smaller.
Specifically, it performs the following optimizations:
- Removal of variants not present in the variants table (unused data).
- Removal of art sets not present in the campaign_character_arts table (unused data).
It returns if the PortraitSettings is empty, meaning it can be safetly deleted.