ChoiceElement

Trait ChoiceElement 

Source
pub trait ChoiceElement {
    // Required methods
    fn base_name() -> &'static str;
    fn possible_field_names() -> Vec<&'static str>;
}
Expand description

Trait for FHIR choice element types.

This trait is implemented by generated enum types that represent FHIR choice elements (fields with [x] in the FHIR specification). It provides metadata about the choice element that enables proper polymorphic access in FHIRPath expressions.

§Example

For a FHIR field like Observation.value[x], the generated enum would implement:

impl ChoiceElement for ObservationValue {
    fn base_name() -> &'static str {
        "value"
    }
     
    fn possible_field_names() -> Vec<&'static str> {
        vec!["valueQuantity", "valueCodeableConcept", "valueString", ...]
    }
}

Required Methods§

Source

fn base_name() -> &'static str

Returns the base name of the choice element without the [x] suffix.

For example, for value[x], this returns “value”.

Source

fn possible_field_names() -> Vec<&'static str>

Returns all possible field names that this choice element can manifest as.

For example, for value[x], this might return: [“valueQuantity”, “valueCodeableConcept”, “valueString”, …]

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§