Documentation
Guides for edifact: parsing, writing, typed derive macros, dates and times, streaming, validation, segment groups, profile packs, CONTRL acknowledgements, diagnostics, and performance tuning for EDIFACT in Rust.
From a first parse to production tuning. Rust snippets are doctests: compiled
and run, except no_run blocks (file and network I/O), which are compiled
only, and one ignored fragment.
New here? Read Getting Started, then
Core Concepts: segments, data elements and the UNA
service string advice.
Reading untrusted input? The
threat model
states what the crate defends against, what it leaves to you (size the
ReaderConfig limits to your traffic; treat values as data), and the evidence
for each claim.
- Getting Started Install edifact, parse your first EDIFACT interchange, and choose the feature flags you need.
- Core Concepts The EDIFACT wire format — segments, data elements, components, the UNA service string advice, release characters, and repetition — mapped onto the Rust types.
- Character Sets Decode UNOA-UNOK and UNOY interchanges, encode them back, and validate a payload against the repertoire its own UNB declares.
- Parsing Zero-copy slice parsing, streaming readers, byte spans, UNA handling, and the ReaderConfig budgets that guard against oversized input.
- Writing Serialize segments back to the EDIFACT wire format with Writer, automatic delimiter escaping, custom UNA service strings, and repeating data elements.
- Dates and times Decode, compare, build and validate EDIFACT DTM values by their UNCL 2379 format code, with optional conversions to the time crate.
- Typed Derive Map EDIFACT segments and messages onto Rust structs with #[derive(EdifactDeserialize, EdifactSerialize)] and address fields by UN/EDIFACT data element identifier.
- Streaming Process large interchanges one segment or one message at a time with reader iterators, message windows, and typed extraction.
- Validation The Validator trait, ValidationContext, and the layered envelope / syntax / charset / structure / code-list / profile validation pipeline.
- Segment Groups GroupDef schemas, the indexed group tree, ordered groups with discriminators, GroupSchema placements and findings, and group-scoped validation.
- Profile Packs Author, compose, merge, and filter business-rule packs with ProfileRulePack, including group-scoped rules.
- CONTRL Acknowledgements Generate the ISO 9735-4 syntax and service report message from a validation report — receipt, acknowledgement, and rejection with per-segment error placement.
- Diagnostics Render EDIFACT errors and validation findings with miette: stable codes, help text, and source spans underlined.
- Async Integration Patterns for using the synchronous edifact parser from tokio without blocking the runtime.
- Error Reference Every EdifactError variant with its stable code E001-E061 and E066-E072, the fields it carries, when it fires, and how to fix it.
- Performance Allocation budget, memory bounds per entry point, the benchmark suite, and ReaderConfig tuning — each figure with the test that asserts it.