Documentation
Guides for edifact-rs: parsing, writing, typed derive macros, streaming, validation, profile packs, CONTRL acknowledgements, diagnostics, and performance tuning for EDIFACT in Rust.
Everything from a first parse to production tuning. Each guide is self-contained; every Rust snippet on this site is compiled and run as part of the test suite, so nothing here can drift from the crate.
If you are new, start with Getting Started and then Core Concepts — the rest assumes you know what a segment, a data element, and the UNA service string advice are.
- Getting Started Install edifact-rs, 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.
- 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 gigabyte interchanges in constant memory with reader iterators, message windows, and typed extraction.
- Validation The Validator trait, ValidationContext, and the layered envelope / structure / code-list / profile validation pipeline.
- 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 Human-readable, span-annotated EDIFACT error output powered by miette.
- Async Integration Three patterns for using the synchronous edifact-rs parser from tokio without blocking the runtime.
- Error Reference Every EdifactError variant with its stable code E001-E053, the fields it carries, when it fires, and how to fix it.
- Performance Zero-copy guarantees, allocation budgets, benchmark suite, and tuning guidance for high-throughput EDIFACT processing.