Skip to main content

StructuredFieldMapping

Struct StructuredFieldMapping 

Source
pub struct StructuredFieldMapping {
    pub target: String,
    pub transform: Option<String>,
    pub when: Option<String>,
    pub default: Option<String>,
    pub enum_map: Option<BTreeMap<String, String>>,
    pub when_filled: Option<Vec<String>>,
    pub also_target: Option<String>,
    pub also_enum_map: Option<BTreeMap<String, String>>,
}
Expand description

A structured field mapping with optional transform and condition.

Fields§

§target: String§transform: Option<String>§when: Option<String>§default: Option<String>§enum_map: Option<BTreeMap<String, String>>

Bidirectional enum translation map (EDIFACT value → BO4E value). Forward: looks up extracted EDIFACT value to produce BO4E value. Reverse: reverse-looks up BO4E value to produce EDIFACT value. Uses BTreeMap for deterministic reverse lookup (first key alphabetically wins).

§when_filled: Option<Vec<String>>

Conditional injection: only inject the default on reverse when ANY of these target field names has a value in the BO4E JSON (checked in both core and companion objects). Used for transport metadata (qualifiers, codelist codes) that should only appear when associated domain data exists.

§also_target: Option<String>

Second target for dual decomposition: one EDIFACT value → two companion fields. Used when a code encodes two concepts (e.g., NAD qualifier = partnerrolle + datenqualitaet). Forward: map raw value via also_enum_map, store as also_target. Reverse: joint lookup — find code where both enum_map and also_enum_map match.

§also_enum_map: Option<BTreeMap<String, String>>

Enum map for the also_target field. Same code keys as enum_map.

Trait Implementations§

Source§

impl Clone for StructuredFieldMapping

Source§

fn clone(&self) -> StructuredFieldMapping

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 Debug for StructuredFieldMapping

Source§

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

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

impl<'de> Deserialize<'de> for StructuredFieldMapping

Source§

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

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

impl Serialize for StructuredFieldMapping

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::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> 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> 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.
Source§

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