Crate hl7_parser

Source
Expand description

HL7v2 message parsing in Rust.

Parses the structure of HL7v2 messages, but does not validate the correctness of the messages.

§Examples

use hl7_parser::{Message, datetime::TimeStamp};
use std::str::FromStr;

let message =
Message::parse("MSH|^~\\&|foo|bar|baz|quux|20010504094523||ADT^A01|1234|P|2.3|||").unwrap();
let msh = message.segment("MSH").unwrap();
assert_eq!(msh.field(3).unwrap().raw_value(), "foo");

let message_time = msh.field(7).unwrap();
let time: TimeStamp = message_time.raw_value().parse().unwrap();
assert_eq!(time.year, 2001);
assert_eq!(time.month, Some(5));
assert_eq!(time.day, Some(4));

Re-exports§

pub use message::Message;

Modules§

builder
HL7 Message Builder
datetime
Timestamp parsing and utilities to translate to and from the chrono and time crates.
display
Structs for displaying parsed HL7 message values. Especially useful for decoding escaped values.
locate
Utilities for locating a cursor within an HL7 message.
message
Structs for representing HL7 messages.
parser
Functions to parse various parts of an HL7 message. Probably not useful to you (use the Message::parse method instead).
query
Human-readable location queries for HL7 messages.

Functions§

parse_message
Parses an HL7 message into a structured form. Equivalent to calling Message::parse(message).
parse_message_with_lenient_newlines
Parses an HL7 message into a structured form, allowing lenient newlines. Equivalent to calling Message::parse_with_lenient_newlines(message, true).