pub struct ConversionService { /* private fields */ }Expand description
High-level service that holds a parsed MIG schema and provides convenient methods for EDIFACT conversion.
Implementations§
Source§impl ConversionService
impl ConversionService
Sourcepub fn new(
mig_path: &Path,
message_type: &str,
variant: Option<&str>,
format_version: &str,
) -> Result<ConversionService, AssemblyError>
pub fn new( mig_path: &Path, message_type: &str, variant: Option<&str>, format_version: &str, ) -> Result<ConversionService, AssemblyError>
Create a new ConversionService by loading a MIG XML file.
Sourcepub fn from_mig(mig: MigSchema) -> ConversionService
pub fn from_mig(mig: MigSchema) -> ConversionService
Create a ConversionService from an already-parsed MIG schema.
Sourcepub fn convert_to_tree(&self, input: &str) -> Result<Value, AssemblyError>
pub fn convert_to_tree(&self, input: &str) -> Result<Value, AssemblyError>
Convert EDIFACT input to an assembled tree, serialized as JSON.
Sourcepub fn convert_to_assembled_tree(
&self,
input: &str,
) -> Result<AssembledTree, AssemblyError>
pub fn convert_to_assembled_tree( &self, input: &str, ) -> Result<AssembledTree, AssemblyError>
Convert EDIFACT input to an AssembledTree (typed, not JSON).
Sourcepub fn convert_interchange_to_trees(
&self,
input: &str,
) -> Result<(InterchangeChunks, Vec<AssembledTree>), AssemblyError>
pub fn convert_interchange_to_trees( &self, input: &str, ) -> Result<(InterchangeChunks, Vec<AssembledTree>), AssemblyError>
Convert a complete interchange into per-message assembled trees.
Steps:
- Parse input to segments
- Split at UNH/UNT boundaries
- Assemble each message independently
Returns the InterchangeChunks (for envelope access) and a Vec<AssembledTree>
(one per message, in order).
Sourcepub fn convert_to_assembled_tree_with_config(
&self,
input: &str,
config: AssemblerConfig,
) -> Result<AssembledTree, AssemblyError>
pub fn convert_to_assembled_tree_with_config( &self, input: &str, config: AssemblerConfig, ) -> Result<AssembledTree, AssemblyError>
Convert EDIFACT input to an AssembledTree with custom assembler config.
Sourcepub fn convert_interchange_to_trees_with_config(
&self,
input: &str,
config: AssemblerConfig,
) -> Result<(InterchangeChunks, Vec<AssembledTree>), AssemblyError>
pub fn convert_interchange_to_trees_with_config( &self, input: &str, config: AssemblerConfig, ) -> Result<(InterchangeChunks, Vec<AssembledTree>), AssemblyError>
Convert a complete interchange into per-message assembled trees with custom config.
Auto Trait Implementations§
impl Freeze for ConversionService
impl RefUnwindSafe for ConversionService
impl Send for ConversionService
impl Sync for ConversionService
impl Unpin for ConversionService
impl UnsafeUnpin for ConversionService
impl UnwindSafe for ConversionService
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more