pub enum ParsedReference<'a> {
    Local {
        id: &'a str,
    },
    Relative {
        resource_type: &'a str,
        id: &'a str,
        version_id: Option<&'a str>,
    },
    Absolute {
        url: &'a str,
        resource_type: Option<&'a str>,
        id: Option<&'a str>,
    },
}
Expand description

Parsed parts of a FHIR reference. Can be one of local reference, relative reference or absolute reference. The absolute reference is unchecked and can be anything, it is used as fallback.

Variants§

§

Local

Fields

§id: &'a str

Local ID of the resource.

Local reference, the resource is to be found in the contained field.

§

Relative

Fields

§resource_type: &'a str

Resource type.

§id: &'a str

Resource ID.

§version_id: Option<&'a str>

Targeted version ID if set.

Relative reference, the resource is on the same FHIR server.

§

Absolute

Fields

§url: &'a str

Raw URL string.

§resource_type: Option<&'a str>

Assumed resource type part if exists. Is just the positional URL segment, could be wrong.

§id: Option<&'a str>

Assumed resource ID part if exists. Is just the positional URL segment, could be wrong.

Absolute reference, the resource can be anywhere, might not even be FHIR server. Might not be a URL, but a URI like a urn:uuid:....

Implementations§

source§

impl<'a> ParsedReference<'a>

source

pub fn new(reference: &'a str) -> Self

Parse the reference from a reference string.

source

pub fn resource_type(&self) -> Option<&'a str>

Get the resource type that this reference points to as string reference. Might not be present/visible in absolute URLs or local references. In absolute URLs, it might also return garbage, as the URL might have enough segments, but the segment was not an actual resource type. Take care when parsing to ResourceType.

source

pub fn id(&self) -> Option<&'a str>

Get the resource ID that this reference points to. Might not be present/visible in absolute URLs. In absolute URLs, it might also return garbage, as the URL might have enough segments, but the segment was not an actual id. Take care when using it.

Trait Implementations§

source§

impl<'a> Clone for ParsedReference<'a>

source§

fn clone(&self) -> ParsedReference<'a>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<'a> Debug for ParsedReference<'a>

source§

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

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

impl<'a> PartialEq for ParsedReference<'a>

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> Copy for ParsedReference<'a>

source§

impl<'a> Eq for ParsedReference<'a>

source§

impl<'a> StructuralEq for ParsedReference<'a>

source§

impl<'a> StructuralPartialEq for ParsedReference<'a>

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for ParsedReference<'a>

§

impl<'a> Send for ParsedReference<'a>

§

impl<'a> Sync for ParsedReference<'a>

§

impl<'a> Unpin for ParsedReference<'a>

§

impl<'a> UnwindSafe for ParsedReference<'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> 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,

§

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

§

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

§

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.