Struct Field

Source
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>

Source

pub fn parse<S: Into<&'a str>>( input: S, delims: &Separators, ) -> Result<Field<'a>, Hl7ParseError>

Convert the given line of text into a field.

Source

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{})`

Source

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.

Source

pub fn value(&self) -> &'a str

Compatibility method to get the underlying value of this field.

Source

pub fn as_str(&self) -> &'a str

Export value to str

Source

pub fn query<'b, S>(&self, sidx: S) -> &'a str
where S: Into<&'b str>,

Access string reference of a Field component by String index Adjust the index by one as medical people do not count from zero

Trait Implementations§

Source§

impl<'a> Clone for Field<'a>

Source§

fn clone(&self) -> Self

Creates a new Message object using a clone of the original’s source

1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for Field<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> Display for Field<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Required for to_string() and other formatter consumers

Source§

impl<'a> Index<(usize, usize)> for Field<'a>

Source§

fn index(&self, idx: (usize, usize)) -> &Self::Output

Access string reference of a Field subcomponent by numeric index

Source§

type Output = &'a str

The returned type after indexing.
Source§

impl<'a> Index<(usize, usize, usize)> for Field<'a>

Source§

fn index(&self, idx: (usize, usize, usize)) -> &Self::Output

Access string reference of a Field subcomponent by numeric index

Source§

type Output = &'a str

The returned type after indexing.
Source§

impl<'a> Index<usize> for Field<'a>

Source§

fn index(&self, idx: usize) -> &Self::Output

Access string reference of a Field component by numeric index

Source§

type Output = &'a str

The returned type after indexing.
Source§

impl<'a> PartialEq for Field<'a>

Source§

fn eq(&self, other: &Field<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.