pub struct Field<'a> {
pub source: &'a str,
pub delims: Separators,
pub repeats: Vec<&'a str>,
pub components: Vec<Vec<&'a str>>,
pub subcomponents: Vec<Vec<Vec<&'a str>>>,
}
Expand description
Represents a single field inside the HL7. Note that fields can include repeats, components and sub-components. See the spec for more info
Fields§
§source: &'a str
§delims: Separators
§repeats: Vec<&'a str>
§components: Vec<Vec<&'a str>>
§subcomponents: Vec<Vec<Vec<&'a str>>>
Implementations§
Source§impl<'a> Field<'a>
impl<'a> Field<'a>
Sourcepub fn parse<S: Into<&'a str>>(
input: S,
delims: &Separators,
) -> Result<Field<'a>, Hl7ParseError>
pub fn parse<S: Into<&'a str>>( input: S, delims: &Separators, ) -> Result<Field<'a>, Hl7ParseError>
Convert the given line of text into a field.
Sourcepub fn parse_mandatory(
input: Option<&'a str>,
delims: &Separators,
) -> Result<Field<'a>, Hl7ParseError>
pub fn parse_mandatory( input: Option<&'a str>, delims: &Separators, ) -> Result<Field<'a>, Hl7ParseError>
Used to hide the removal of NoneError for #2… If passed Some()
value it returns a field with that value. If passed None() it returns an
Err(Hl7ParseError::MissingRequiredValue{})`
Sourcepub fn parse_optional(
input: Option<&'a str>,
delims: &Separators,
) -> Result<Option<Field<'a>>, Hl7ParseError>
pub fn parse_optional( input: Option<&'a str>, delims: &Separators, ) -> Result<Option<Field<'a>>, Hl7ParseError>
Converts a possibly blank string into a possibly blank field!
Note this handles optional fields, not the nul (""
) value.
Trait Implementations§
impl<'a> StructuralPartialEq for Field<'a>
Auto Trait Implementations§
impl<'a> Freeze for Field<'a>
impl<'a> RefUnwindSafe for Field<'a>
impl<'a> Send for Field<'a>
impl<'a> Sync for Field<'a>
impl<'a> Unpin for Field<'a>
impl<'a> UnwindSafe for Field<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more