Documentation
How rubo4e is put together, what it guarantees, and where the domain rules behind the BO4E standard come from.
These pages cover the design and the domain, not the API surface — for signatures and per-item documentation, use the API reference.
BO4E (Geschäftsobjekte für die Energiewirtschaft) is the object model the German energy industry uses to exchange contracts, metering points, invoices, and the parties involved. The standard is published as JSON Schema; rubo4e generates Rust types from it and adds the rules the schema itself cannot express — check digits, cross-field invariants, and strict decoding boundaries.
If you are new to the crate, read Architecture first for the layout, then Identifiers for the part that carries the most domain weight.
If you are extending it — because a market rule needs a fact BO4E has no field for — read Beyond the Schema. It carries the one test every addition passes, and the reason a generated enum is never forked.
Architecture
Workspace layout, module tree, and the feature-gate taxonomy — plus where the boundary sits between this library and your application code.
Identifiers
Every BO4E market identifier as a validated newtype: MaLo-ID, MeLo-ID, the Zählpunktbezeichnung, EIC, OBIS, Marktpartner-ID, the Lokationsbündel codes, the Redispatch 2.0 resource IDs and the SEPA bank identifiers, with the check-digit procedures behind them.
Lokationsbündel
There is no Lokationsbuendel Geschäftsobjekt in BO4E — there is a Lokationszuordnung and two BDEW codes. The published EDI@Energy codelist, shipped as data, and an audit that checks a bundle against the structure it declares.
Serialization
German camelCase, snake_case, and canonical JSON output; round-trip preservation of unknown fields; and the limits that make parsing untrusted payloads safe.
Validation
The three independent validation layers — constructor invariants, garde-based cross-field rules, and JSON Schema — and when to reach for each.
Time Series & Units
Interval series and register series, one reading shape across Lastgang, Zeitreihe and Energiemenge, the coverage audit, Zeitraum's instant mode, and the unit dimensions behind sum, integrate and consumption.
Beyond the Schema
What rubo4e does when a market rule needs something BO4E has not modelled: the one test every addition passes, where each kind of addition lands, and BK6-20-160 Modell 2 worked through end to end as the example.
Schema Versioning
How BO4E schema releases map onto Rust modules, what rubo4e::current guarantees, and which imports to pin when enum membership must not move underneath you.
Ecosystem Integrations
Optional serde, sqlx, schemars, utoipa, strum, and proptest integrations — each behind a feature gate, each costing nothing when disabled.
Code Generator
How the internal generator turns pinned BO4E JSON Schema releases into Rust source, including type inference, identifier naming, and the drift checks that keep output honest.
Testing Strategy
The eight testing layers that back this crate: schema drift guards, golden corpus, snapshots, property tests, fuzzing, cross-implementation compatibility, doctests, and the feature matrix.