Skip to main content

Bo4eFieldIndex

Struct Bo4eFieldIndex 

Source
pub struct Bo4eFieldIndex { /* private fields */ }
Expand description

Maps EDIFACT segment paths from validation errors to BO4E field paths.

Implementations§

Source§

impl Bo4eFieldIndex

Source

pub fn build(definitions: &[MappingDefinition], mig: &MigSchema) -> Self

Build the index from TOML mapping definitions and a MIG schema.

For each field in each definition, resolves the TOML numeric path (e.g., loc.1.0) to an AHB-style EDIFACT path (e.g., SG4/SG5/LOC/C517/3225) using the MIG schema for element ID lookup.

Source

pub fn build_with_resolver( definitions: &[MappingDefinition], mig: &MigSchema, resolver: &ReversePathResolver, ) -> Self

Build the index using a ReversePathResolver for element ID lookup.

This is more accurate than build because the resolver is built from unmerged PID schema JSONs, avoiding data loss from MIG group merging (e.g., CCI composites lost when merging SG10 variants).

Source

pub fn resolve( &self, edifact_field_path: &str, hint: Option<&str>, ) -> Option<String>

Given an EDIFACT field_path from a ValidationIssue, return the BO4E path.

hint is an optional disambiguation string (e.g., expected value or AHB rule) that helps pick the right entry when multiple TOML definitions map to the same EDIFACT path (e.g., DTM+92 and DTM+93 both map to SG4/DTM/C507/2005).

Source

pub fn debug_entries(&self) -> Vec<(String, String, String)>

Debug: return all entries as (edifact_path, entity, bo4e_field) tuples.

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.