Expand description
§HL7 Message Builder
This module provides a builder for constructing HL7 messages. The builder can be used to construct messages from scratch, or to modify existing messages.
§Examples
use hl7_parser::builder::prelude::*;
let message = MessageBuilder::new(Separators::default())
.with_segment(SegmentBuilder::new("MSH")
.with_field_value(3, "SendingApp")
.with_field_value(4, "SendingFac")
.with_field_value(5, "ReceivingApp")
.with_field_value(6, "ReceivingFac")
.with_field(9,
FieldBuilder::default()
.with_component(1, "ADT")
.with_component(2, "A01"))
.with_field_value(10, "123456")
.with_field_value(11, "P")
.with_field_value(12, "2.3"))
.with_segment(SegmentBuilder::new("PID")
.with_field_value(3, "123456")
.with_field(5,
FieldBuilder::default()
.with_component(1, "Doe")
.with_component(2, "John"))
.with_field_value(7, "19700101"))
.render_with_newlines().to_string();
assert_eq!(message,
"MSH|^~\\&|SendingApp|SendingFac|ReceivingApp|ReceivingFac|||ADT^A01|123456|P|2.3\nPID|||123456||Doe^John||19700101");
Modules§
- prelude
- Prelude for building HL7 messages.
Structs§
- Message
Builder - A builder for constructing HL7 messages.
- Segment
Builder - A builder for constructing HL7 segments.