pub struct Message<'a> {
pub source: &'a str,
pub segments: Vec<Segment<'a>>,
/* private fields */
}
Expand description
A Message is an entire HL7 message parsed into it’s constituent segments, fields, repeats and subcomponents, and it consists of (1 or more) Segments. Message parses the source string into &str slices (minimising copying)
Fields§
§source: &'a str
§segments: Vec<Segment<'a>>
Implementations§
Source§impl<'a> Message<'a>
impl<'a> Message<'a>
pub fn new(source: &'a str) -> Message<'a>
Sourcepub fn segments_by_name(
&self,
name: &str,
) -> Result<Vec<&Segment<'a>>, Hl7ParseError>
pub fn segments_by_name( &self, name: &str, ) -> Result<Vec<&Segment<'a>>, Hl7ParseError>
Extracts generic elements for external use by matching first field to name
Sourcepub fn segments_to_str_vecs(
segments: Vec<&Segment<'a>>,
) -> Result<Vec<Vec<&'a str>>, Hl7ParseError>
pub fn segments_to_str_vecs( segments: Vec<&Segment<'a>>, ) -> Result<Vec<Vec<&'a str>>, Hl7ParseError>
Present input vectors of &generics to vectors of &str
Sourcepub fn as_str(&self) -> &'a str
pub fn as_str(&self) -> &'a str
Returns the source string slice used to create this Message initially. This method does not allocate.
§Example:
let source = "MSH|^~\\&|GHH LAB|ELAB-3|GHH OE|BLDG4|200202150930||ORU^R01|CNTRL-3456|P|2.4";
let m = Message::try_from(source)?;
assert_eq!(source, m.as_str());
Sourcepub fn get_separators(&self) -> Separators
pub fn get_separators(&self) -> Separators
Gets the delimiter information for this Message
Sourcepub fn query<'b, S>(&self, idx: S) -> &'a str
pub fn query<'b, S>(&self, idx: S) -> &'a str
Access Segment, Field, or sub-field string references by string index
Sourcepub fn parse_query_string(query: &str) -> Vec<&str>
pub fn parse_query_string(query: &str) -> Vec<&str>
Parse query/index string to fill-in missing values. Required when conumer requests “PID.F3.C1” to pass integers down to the usize indexers at the appropriate positions
Trait Implementations§
Source§impl<'a> Clone for Message<'a>
impl<'a> Clone for Message<'a>
Source§fn clone(&self) -> Self
fn clone(&self) -> Self
Creates a new cloned Message object referencing the same source slice as the original.
§Example:
let m = Message::try_from("MSH|^~\\&|GHH LAB|ELAB-3|GHH OE|BLDG4|200202150930||ORU^R01|CNTRL-3456|P|2.4")?;
let cloned = m.clone(); // this object is looking at the same string slice as m
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more