Skip to main content

Crate edi_energy

Crate edi_energy 

Source
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 a Profile and 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§

CustomRulePack
A caller-supplied validation rule pack that can be merged on top of all built-in validation layers when calling EdiEnergyMessage::validate_with_pack.
EdiEnergyReport
The result of validating an EDI@Energy message.
InterchangeHeader
Parsed UNB interchange envelope header fields.
InterchangeIter
Lazy iterator over MessageEnvelopes from a parsed EDIFACT interchange.
LightMessage
Envelope-only view of a parsed EDIFACT/EDI@Energy message.
MessageEnvelope
A single parsed message together with its enclosing interchange envelope header.
ParseConfig
Configuration for the EDIFACT byte-slice parser.
ParsedInterchange
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).
ReaderConfig
Configuration for reader-based EDIFACT parsers.
ReceiptContext
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.
ValidationIssue
A structured validation issue.
ValidationIssueSummary
The mako-facing projection of a single edifact_rs::ValidationIssue.
ValidationReport
A collection of validation results: errors, warnings, and informational notes.

Enums§

AgencyCode
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 LOC DE 3227 Lokationstyp qualifiers.
MessageType
EDIFACT message type codes used in the German energy market (EDI@Energy).
ProfileError
Errors that arise from a malformed or incomplete profile configuration.
ReleaseKind
Parsed structure of an EDI@Energy release code.
ReleaseTrack
Coarse track classification for a BDEW EDI@Energy release code.
RuleOrigin
Which layer of the validation stack produced a finding.
ValidationSeverity
Priority level for a validation error or warning.

Constants§

DEFAULT_MAX_SEGMENT_BYTES
Default per-segment byte limit for ParseConfig.

Traits§

EdiEnergyMessage
Core abstraction for all EDI@Energy message types.
EdifactDeserialize
Types that can be deserialized from a slice of EDIFACT segments.
EdifactSerialize
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, or None when anfrage is 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 msg and additionally enforce that its Prüfidentifikator matches expected.

Derive Macros§

EdifactDeserialize
Derive edifact_rs::EdifactDeserialize for segment or message structs.
EdifactSerialize
Derive edifact_rs::EdifactSerialize for segment or message structs.