Skip to main content

ViewDefinitionTrait

Trait ViewDefinitionTrait 

Source
pub trait ViewDefinitionTrait {
    type Select: ViewDefinitionSelectTrait;
    type Where: ViewDefinitionWhereTrait;
    type Constant: ViewDefinitionConstantTrait;

    // Required methods
    fn resource(&self) -> Option<&str>;
    fn select(&self) -> Option<&[Self::Select]>;
    fn where_clauses(&self) -> Option<&[Self::Where]>;
    fn constants(&self) -> Option<&[Self::Constant]>;
}
Expand description

Trait for abstracting ViewDefinition across FHIR versions.

This trait provides version-agnostic access to ViewDefinition components, enabling the core processing logic to work uniformly across R4, R4B, R5, and R6 specifications. Each FHIR version implements this trait to expose its ViewDefinition structure through a common interface.

§Associated Types

  • Select: The select statement type for this FHIR version
  • Where: The where clause type for this FHIR version
  • Constant: The constant definition type for this FHIR version

§Examples

use helios_sof::traits::ViewDefinitionTrait;

fn process_any_version<T: ViewDefinitionTrait>(vd: &T) {
    if let Some(resource_type) = vd.resource() {
        println!("Processing {} resources", resource_type);
    }
     
    if let Some(selects) = vd.select() {
        println!("Found {} select statements", selects.len());
    }
}

Required Associated Types§

Source

type Select: ViewDefinitionSelectTrait

The select statement type for this FHIR version

Source

type Where: ViewDefinitionWhereTrait

The where clause type for this FHIR version

Source

type Constant: ViewDefinitionConstantTrait

The constant definition type for this FHIR version

Required Methods§

Source

fn resource(&self) -> Option<&str>

Returns the FHIR resource type this ViewDefinition processes

Source

fn select(&self) -> Option<&[Self::Select]>

Returns the select statements that define output columns and structure

Source

fn where_clauses(&self) -> Option<&[Self::Where]>

Returns the where clauses that filter resources before processing

Source

fn constants(&self) -> Option<&[Self::Constant]>

Returns the constants/variables available for use in expressions

Implementations on Foreign Types§

Source§

impl ViewDefinitionTrait for ViewDefinition

Implementors§