hl7-mllp
Transport-agnostic MLLP framing for HL7 v2 messages.
MLLP (Minimal Lower Layer Protocol) is the standard transport envelope for HL7 v2 messages over TCP/IP. This crate provides pure frame encoding and decoding — with no opinion on async runtimes, I/O libraries, or transports.
Design Philosophy
Most existing Rust MLLP crates are tightly coupled to tokio. This crate is not.
- No tokio dependency — bring your own transport
- No async-std dependency — works in sync, async, and
no_stdcontexts - [
MllpTransport] trait — implement for TCP, serial, UART, in-memory, or anything else - Pure framing logic — encode, decode, find frame boundaries
MLLP Frame Format
[VT 0x0B] [HL7 message bytes ...] [FS 0x1C] [CR 0x0D]
Usage
use ;
// Encode a raw HL7 payload into an MLLP frame
let payload = b"MSH|^~\\&|SendApp|SendFac|...";
let framed = encode;
// Decode an MLLP frame back to the raw HL7 payload
let decoded = decode?;
assert_eq!;
// Find frame boundaries in a streaming buffer
if let Some = find_frame_end
Implementing a custom transport
use MllpTransport;
Ecosystem
This crate is part of a family of transport-agnostic HL7 and FHIR crates:
| Crate | Purpose |
|---|---|
hl7-mllp |
MLLP framing (this crate) |
hl7-v2 |
HL7 v2 message parser |
hl7-mindray |
Mindray device HL7 field mappings |
fhir-r4 |
FHIR R4 resource types |
satusehat |
Indonesian SATUSEHAT FHIR profile |
Status
0.1.0 — Spec-complete MLLP implementation (HL7 v2.5.1 Appendix C):
- ✅ MLLP framing: encode/decode with VT/FS/CR delimiters
- ✅ Streaming support:
MllpFramerfor incremental frame accumulation - ✅ ACK/NACK generation with optional
chronotimestamps - ✅
MllpTransporttrait for custom transports - ✅ Noncompliance feature for tolerant parsing
- ✅ Comprehensive documentation and examples
See CHANGELOG.md for details.
License
Apache-2.0