pub struct Encoding {
pub field: u8,
pub component: u8,
pub repetition: u8,
pub escape: u8,
pub subcomponent: u8,
}Expand description
The five delimiter characters of an HL7 v2 message.
The field separator is MSH-1 (byte 3 of the message); the other four are MSH-2, in the order component, repetition, escape, subcomponent. HL7 2.7 adds an optional fifth truncation character which this crate ignores.
Fields§
§field: u8Field separator, conventionally |.
component: u8Component separator, conventionally ^.
repetition: u8Repetition separator, conventionally ~.
escape: u8Escape character, conventionally \.
subcomponent: u8Subcomponent separator, conventionally &.
Implementations§
Source§impl Encoding
impl Encoding
Sourcepub fn from_msh2(field: u8, msh2: &[u8]) -> Option<Encoding>
pub fn from_msh2(field: u8, msh2: &[u8]) -> Option<Encoding>
Build an encoding from the field separator (MSH-1) and the raw bytes of
MSH-2. Returns None when MSH-2 is malformed: fewer than four or more
than five bytes, non-ASCII, duplicated, or colliding with the field
separator. Callers should fall back to Encoding::with_field.
Sourcepub fn with_field(field: u8) -> Encoding
pub fn with_field(field: u8) -> Encoding
The standard encoding characters with a custom field separator.