Expand description
edi-energy — EDI@Energy EDIFACT parser and validator for the German energy market.
§Quick start
use edi_energy::{Platform, AnyMessage, EdiEnergyMessage};
let input: &[u8] = b"UNB+UNOA:3+SENDER+RECEIVER+200101:0900+1'UNH+1+UTILMD:D:11A:UN:S2.2'BGM+E01+11001+9'UNT+2+1'UNZ+1+1'";
let msg = Platform::with_all_profiles().parse(input)?;
let report = msg.validate()?;
assert!(report.is_valid());§Profiles
Every Formatversion of every message type is a Profile: the MIG’s
Nachrichtenstruktur and Segmentlayouts plus the AHB’s Prüfschablonen,
extracted from the BDEW publications and embedded at build time. A message
with a wire release code no embedded profile carries parses but cannot be
validated (Error::ProfileNotFound); Profile::from_json loads a
profile from any source into a ReleaseRegistry of your own.
Re-exports§
pub use profile::Profile;pub use profile::Pruefschablone;pub use registry::DEFAULT_RECEIVE_TOLERANCE_DAYS;pub use registry::ProcessContext;pub use registry::ReleaseRegistry;pub use registry::TransitionState;pub use messages::aperak::AperakError;pub use messages::contrl::ContrlElementError;pub use messages::contrl::ContrlMessageResponse;pub use messages::contrl::ContrlSegmentError;pub use messages::mscons::MsconsDeliveryPoint;pub use messages::mscons::MsconsLineItem;pub use messages::mscons::MsconsQuantity;pub use messages::mscons::MsconsReference;pub use messages::mscons::MsconsTimeSeries;pub use messages::utilmd::UtilmdReference;pub use messages::utilmd::UtilmdTransaction;
Modules§
- builders
- Fluent builder APIs for constructing EDI@Energy messages. Fluent builder APIs for constructing EDI@Energy messages from scratch.
- messages
- Concrete EDI@Energy message type structs, one sub-module per message type.
- profile
- The loaded MIG/AHB profiles: message structure, Prüfschablonen, Bedingungen.
A profile: one Formatversion of one message type — the MIG’s
Nachrichtenstruktur and Segmentlayouts plus the AHB’s Prüfschablonen — as
published by BDEW and extracted by
cargo xtask import-profiles. - registry
- Profile registry mapping
(MessageType, Release)pairs to validation rules. Which profile validates a message: the registry maps(MessageType, Release)to aProfileand resolves the Formatversion in force on a given date. - releases
- The Formatversionen this build embeds, one accessor per profile directory.
- utilmd_
codes - UTILMD SG4/SG5 wire vocabulary — the codes the MIG fixes, as constants.
Structs§
- Custom
Rule Pack - A caller-supplied validation rule pack that can be merged on top of all
built-in validation layers when calling
EdiEnergyMessage::validate_with_pack. - EdiEnergy
Report - The result of validating an EDI@Energy message.
- Interchange
Header - Parsed UNB interchange envelope header fields.
- Interchange
Iter - Lazy iterator over
MessageEnvelopes from a parsed EDIFACT interchange. - Light
Message - Envelope-only view of a parsed EDIFACT/EDI@Energy message.
- Message
Envelope - A single parsed message together with its enclosing interchange envelope header.
- Parse
Config - Configuration for the EDIFACT byte-slice parser.
- Parsed
Interchange - A fully parsed EDIFACT interchange with envelope metadata preserved.
- Parser
- A configured parser for EDI@Energy messages and interchanges.
- Platform
- An explicit EDI@Energy processing context.
- Pruefidentifikator
- A validated EDI@Energy Pruefidentifikator (document-identifier code).
- Reader
Config - Configuration for reader-based EDIFACT parsers.
- Receipt
Context - Context needed to build an acknowledgement (APERAK / CONTRL) for a received message.
- Release
- The EDI@Energy release / association-code identifier extracted from the UNH segment.
- Validation
Issue - A structured validation issue.
- Validation
Issue Summary - The mako-facing projection of a single
edifact_rs::ValidationIssue. - Validation
Report - A collection of validation results: errors, warnings, and informational notes.
Enums§
- Agency
Code - EDIFACT DE 3055 — code list responsible agency for market participant identification.
- AnyMessage
- A parsed EDI@Energy message, dispatched to its concrete type.
- Error
- All errors that can be produced by
edi-energy. - Lokationstyp
- Domain type for the UTILMD
SG5 LOCDE 3227 Lokationstyp qualifiers. - Message
Type - EDIFACT message type codes used in the German energy market (EDI@Energy).
- Profile
Error - Errors that arise from a malformed or incomplete profile configuration.
- Release
Kind - Parsed structure of an EDI@Energy release code.
- Release
Track - Coarse track classification for a BDEW EDI@Energy release code.
- Rule
Origin - Which layer of the validation stack produced a finding.
- Validation
Severity - Priority level for a validation error or warning.
Constants§
- DEFAULT_
MAX_ SEGMENT_ BYTES - Default per-segment byte limit for
ParseConfig.
Traits§
- EdiEnergy
Message - Core abstraction for all EDI@Energy message types.
- Edifact
Deserialize - Types that can be deserialized from a slice of EDIFACT segments.
- Edifact
Serialize - Types that can serialize themselves to an EDIFACT event stream.
Functions§
- ablehnung_
pid - The Ablehnung Prüfidentifikator for an Anfrage, if the AHB defines one.
- answer_
pids - The
(Bestätigung, Ablehnung)Prüfidentifikatoren the AHB assigns to an Anfrage, orNonewhenanfrageis not a request PID. - bestaetigung_
pid - The Bestätigung Prüfidentifikator for an Anfrage, if the AHB defines one.
- parse
- Parse a single EDIFACT message from a byte slice using the global registry.
- parse_
envelope_ only - Parse only the UNH/BGM envelope fields from a byte slice, without constructing typed message structs.
- parse_
interchange - Parse all messages from an interchange using the global registry.
- validate_
and_ check_ pid - Validate
msgand additionally enforce that its Prüfidentifikator matchesexpected.
Derive Macros§
- Edifact
Deserialize - Derive
edifact_rs::EdifactDeserializefor segment or message structs. - Edifact
Serialize - Derive
edifact_rs::EdifactSerializefor segment or message structs.