Skip to main content

Module types

Module types 

Source
Expand description

Semantic domain type wrappers for identifiers used across all MaKo process families.

All types in this module wrap Box<str> rather than String — they are immutable identifiers that are never mutated after construction. Box<str> is one pointer word smaller than String on the stack and avoids the extra capacity bookkeeping.

§Why newtypes instead of String?

Domain commands and events have many identifier fields:

ReceiveUtilmd {
    sender:        String,  // GLN
    receiver:      String,  // GLN
    location_id:   String,  // MaLo / EIC
    document_date: String,  // YYYYMMDD
    message_ref:   String,  // EDIFACT reference
}

Passing location_id where sender is expected is a compile-time no-op when all fields are String. Typed wrappers turn that into a type error.

§Construction

All types implement From<String> and From<&str> for ergonomic construction without .into() gymnastics:

use mako_engine::types::{MaLo, MarktpartnerCode};

let malo:   MaLo             = MaLo::new("51238696012");
let sender: MarktpartnerCode = MarktpartnerCode::new("9900123456789");

§These are wire-boundary types, not validated value objects

The wrappers carry no format or check-digit validation: a message arriving over AS4 may hold a malformed identifier, and the process must be able to represent it in order to reject it with a precise, citable error. Validation belongs one layer in, where rubo4e::identifiers::{MaloId, MeloId, MarktpartnerId} provide the check-digit-validated domain value objects. Treat a value of this module’s types as “whatever the counterparty sent”, never as “a valid MaLo”.

§Serde

All types serialize/deserialize as plain JSON strings, keeping event payloads human-readable in SlateDB and log output.

Structs§

BikoId
Bilanzkoordinator-ID (BIKO).
BillingPeriod
Abrechnungszeitraum (billing period).
BkvId
Bilanzkreisverantwortlicher-ID (BKV).
DeviceId
Geräte-ID / Zählernummer.
MaLo
Marktlokations-ID (MaLo).
MarktpartnerCode
Market-participant identifier (Marktpartner-Code).
MeLo
Messlokations-ID (MeLo).
MessageRef
EDIFACT message reference.
MeteredInterval
One decoded metered value from an MSCONS SG9/SG10 group.
Pruefidentifikator
Serde representation
UenbId
Übertragungsnetzbetreiber-ID (ÜNB).

Enums§

Sparte
A validated BDEW process-type code (Prüfidentifikator, PID).