pub struct VariantCache {
pub message_defs: Vec<MappingDefinition>,
pub transaction_defs: HashMap<String, Vec<MappingDefinition>>,
pub combined_defs: HashMap<String, Vec<MappingDefinition>>,
pub code_lookups: HashMap<String, CodeLookup>,
pub mig_schema: Option<MigSchema>,
pub segment_structure: Option<SegmentStructure>,
pub pid_segment_numbers: HashMap<String, Vec<String>>,
pub pid_requirements: HashMap<String, PidRequirements>,
}Expand description
Precompiled cache for a single format-version/variant (e.g., FV2504/UTILMD_Strom).
Contains all engines with paths pre-resolved, ready for immediate use.
Loading one VariantCache file replaces thousands of individual .bin reads.
Fields§
§message_defs: Vec<MappingDefinition>Message-level definitions (shared across PIDs).
transaction_defs: HashMap<String, Vec<MappingDefinition>>Per-PID transaction definitions (key: “pid_55001”).
combined_defs: HashMap<String, Vec<MappingDefinition>>Per-PID combined definitions (key: “pid_55001”).
code_lookups: HashMap<String, CodeLookup>Per-PID code lookups (key: “pid_55001”). Cached to avoid reading schema JSONs at load time.
mig_schema: Option<MigSchema>Parsed MIG schema — cached to avoid re-parsing MIG XML at startup.
segment_structure: Option<SegmentStructure>Segment element counts derived from MIG — cached for reverse mapping padding.
pid_segment_numbers: HashMap<String, Vec<String>>Per-PID AHB segment numbers (key: “pid_55001”). Used for MIG filtering at runtime. Eliminates the need to parse AHB XML files at startup.
pid_requirements: HashMap<String, PidRequirements>Per-PID field requirements (key: “pid_55001”). Built from PID schema + TOML definitions.
Used by validate_pid() to check field completeness.
Implementations§
Source§impl VariantCache
impl VariantCache
Sourcepub fn save(&self, path: &Path) -> Result<(), MappingError>
pub fn save(&self, path: &Path) -> Result<(), MappingError>
Save this variant cache to a single JSON file.
Sourcepub fn load(path: &Path) -> Result<VariantCache, MappingError>
pub fn load(path: &Path) -> Result<VariantCache, MappingError>
Load a variant cache from a single JSON file.