Skip to main content

PrimVec

Struct PrimVec 

Source
pub struct PrimVec<T>(pub Vec<Option<T>>);
Expand description

The values of a repeating FHIR primitive element (0..*).

A thin, transparent wrapper over Vec<Option<T>>: None is an extension-only placeholder — the JSON null whose position in the paired _element array carries the extension. Use values to iterate the actual values, iter to see positions.

A placeholder with no corresponding _element entry is meaningless in FHIR; nothing here prevents constructing one, but the serializer will faithfully write the null, and validation flags it (Validate for PrimVec).

Tuple Fields§

§0: Vec<Option<T>>

Implementations§

Source§

impl<T> PrimVec<T>

Source

pub fn new() -> Self

An empty value array.

Source

pub fn len(&self) -> usize

Number of positions, placeholders included.

Source

pub fn is_empty(&self) -> bool

True when there are no positions at all.

Source

pub fn values(&self) -> impl Iterator<Item = &T>

The values, skipping extension-only placeholders.

Source

pub fn iter(&self) -> Iter<'_, Option<T>>

Every position: Some(value) or None for a placeholder.

Source

pub fn push(&mut self, value: T)

Append a value.

Source

pub fn push_placeholder(&mut self)

Append an extension-only placeholder (a JSON null; its extension lives at the same index of the _element sibling field).

Source

pub fn first_value(&self) -> Option<&T>

The first actual value, if any position holds one.

Trait Implementations§

Source§

impl<T: Clone> Clone for PrimVec<T>

Source§

fn clone(&self) -> PrimVec<T>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for PrimVec<T>

Source§

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

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

impl<T: Default> Default for PrimVec<T>

Source§

fn default() -> PrimVec<T>

Returns the “default value” for a type. Read more
Source§

impl<'de, T> Deserialize<'de> for PrimVec<T>
where T: Deserialize<'de>,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<T: Eq> Eq for PrimVec<T>

Source§

impl<T> From<Vec<T>> for PrimVec<T>

Source§

fn from(values: Vec<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> FromIterator<Option<T>> for PrimVec<T>

Source§

fn from_iter<I: IntoIterator<Item = Option<T>>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<T> FromIterator<T> for PrimVec<T>

Source§

fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<T> IntoIterator for PrimVec<T>

Source§

type Item = Option<T>

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<Option<T>>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, T> IntoIterator for &'a PrimVec<T>

Source§

type Item = &'a Option<T>

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, Option<T>>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T: PartialEq> PartialEq for PrimVec<T>

Source§

fn eq(&self, other: &PrimVec<T>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl<T> Serialize for PrimVec<T>
where T: Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<T: PartialEq> StructuralPartialEq for PrimVec<T>

Source§

impl<T: Validate> Validate for PrimVec<T>

Source§

fn validate(&self) -> Vec<ValidationIssue>

Return all validation issues; an empty vector means the value is valid.
Source§

fn is_valid(&self) -> bool

Convenience: true when Validate::validate finds no issues.

Auto Trait Implementations§

§

impl<T> Freeze for PrimVec<T>
where Vec<Option<T>>: Freeze,

§

impl<T> RefUnwindSafe for PrimVec<T>

§

impl<T> Send for PrimVec<T>
where Vec<Option<T>>: Send,

§

impl<T> Sync for PrimVec<T>
where Vec<Option<T>>: Sync,

§

impl<T> Unpin for PrimVec<T>
where Vec<Option<T>>: Unpin,

§

impl<T> UnsafeUnpin for PrimVec<T>
where Vec<Option<T>>: UnsafeUnpin,

§

impl<T> UnwindSafe for PrimVec<T>
where Vec<Option<T>>: UnwindSafe,

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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.