Skip to main content

DataBundle

Struct DataBundle 

Source
pub struct DataBundle {
    pub format_version: String,
    pub bundle_version: u32,
    pub variants: BTreeMap<String, VariantCache>,
    pub bo4e_catalog: Bo4eCatalog,
    pub built_by: Option<String>,
    pub code_lists: CodeLists,
}
Expand description

Bundled data for a single format version (e.g., FV2504).

Contains all VariantCaches for every message type in that FV, serialized as one bincode file for distribution via GitHub releases.

Fields§

§format_version: String§bundle_version: u32§variants: BTreeMap<String, VariantCache>§bo4e_catalog: Bo4eCatalog

PID-agnostic BO4E type catalog (parsed from bo4e-german source).

Populated by the bundle generator at compile-mappings time. Older bundles without this field deserialize to an empty catalog.

§built_by: Option<String>

The crate version that produced this bundle.

Distinct from bundle_version, which guards the serialisation format and has been unchanged for many releases — a bundle can satisfy it while its mappings, schemas and code lists come from another era. That is not a hypothetical: a bundle five months old passed the format check, loaded cleanly, and rendered 12% of a message with no error (issue #158).

None for bundles produced before this field existed, which is itself evidence of age.

§code_lists: CodeLists

The shared code-list tables the definitions’ code_list names resolve against.

Carried IN the bundle, unlike VariantCache, which is written beside a copy of code_lists.toml and repairs itself from it on load. A bundle is a bare .bin fetched into ~/.edifact/data with nothing beside it, so a bundle that does not carry its tables cannot resolve a single name: forward, the EDIFACT code reaches the output untranslated; reverse, the BO4E name is written into the EDIFACT slot verbatim. The deduplication that made naming worth doing does not argue against this – there is one bundle per format version, so the tables appear once.

Implementations§

Source§

impl DataBundle

Source

pub const CURRENT_VERSION: u32 = 2

Source

pub const PRODUCING_VERSION: &'static str = "0.8.0"

The release a bundle built now belongs to, and the one a bundle must have been built by to be read.

Taken from mig-bo4e rather than from whichever crate produces or consumes a bundle: mig-bo4e carries the workspace version, which is what the release process stamps, while automapper-generator versions itself separately. Reading it from the producer gave 0.1.0 against a consumer expecting 0.1.1 — a mismatch that is an artefact of where the constant was read, not of the data.

Source

pub fn variant(&self, name: &str) -> Option<&VariantCache>

Source

pub fn write_to<W>(&self, writer: &mut W) -> Result<(), MappingError>
where W: Write,

Source

pub fn read_from<R>(reader: &mut R) -> Result<DataBundle, MappingError>
where R: Read,

Source

pub fn read_from_checked<R>(reader: &mut R) -> Result<DataBundle, MappingError>
where R: Read,

Source

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

Source

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

Trait Implementations§

Source§

impl<'de> Deserialize<'de> for DataBundle

Source§

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

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

impl Serialize for DataBundle

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more