Expand description
HL7 v2 message writer/serializer.
This crate provides serialization functionality for HL7 v2 messages, including:
- Converting message structures to HL7 format
- MLLP framing for network transmission
- JSON serialization (re-exported from hl7v2-json)
§Example
use hl7v2_model::{Message, Segment, Field, Rep, Comp, Atom, Delims};
use hl7v2_writer::write;
let message = Message {
delims: Delims::default(),
segments: vec![
Segment {
id: *b"MSH",
fields: vec![
Field::from_text("^~\\&"), // MSH-2 encoding chars
Field::from_text("SendingApp"),
],
},
],
charsets: vec![],
};
let bytes = write(&message);
assert!(bytes.starts_with(b"MSH|"));Functions§
- to_json
- Convert message to canonical JSON.
- to_
json_ string - Convert message to JSON string.
- to_
json_ string_ pretty - Convert message to pretty JSON string.
- write
- Write HL7 message to bytes.
- write_
batch - Write batch to bytes.
- write_
file_ batch - Write file batch to bytes.
- write_
mllp - Write HL7 message with MLLP framing.