Skip to main content

VariantCache

Struct VariantCache 

Source
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

Source

pub fn save(&self, path: &Path) -> Result<(), MappingError>

Save this variant cache to a single JSON file.

Source

pub fn load(path: &Path) -> Result<VariantCache, MappingError>

Load a variant cache from a single JSON file.

Trait Implementations§

Source§

impl<'de> Deserialize<'de> for VariantCache

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<VariantCache, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for VariantCache

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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> 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, 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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,