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("DE00123456789012345678901234567890");
let sender: MarktpartnerCode = MarktpartnerCode::new("9900123456789");

§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.
Pruefidentifikator
Serde representation
UenbId
Übertragungsnetzbetreiber-ID (ÜNB).

Enums§

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