Expand description
File generation and organization functionality
This module handles writing generated code to files and organizing the output structure.
§Ergonomic Improvements for Trait Usage
This module implements two key ergonomic improvements for generated FHIR resources:
§1. Trait Re-exports in Resource Modules
Each generated resource module (e.g., resources::patient) automatically re-exports its
associated traits (PatientMutators, PatientAccessors, PatientExistence). This allows
users to import just the resource module and get all necessary traits:
ⓘ
// Before: Required importing from multiple modules
use hl7_fhir_r4_core::resources::patient::Patient;
use hl7_fhir_r4_core::traits::patient::PatientMutators;
use hl7_fhir_r4_core::traits::domain_resource::DomainResourceMutators;
use hl7_fhir_r4_core::traits::resource::ResourceMutators;
// After: Single import gets everything needed
use hl7_fhir_r4_core::resources::patient::{Patient, PatientMutators};
// Note: Parent traits (ResourceMutators, DomainResourceMutators) are trait bounds,
// so they're brought into scope automatically when PatientMutators is used§2. Prelude Module
A prelude module is generated that re-exports commonly used base traits:
ⓘ
use hl7_fhir_r4_core::prelude::*;
use hl7_fhir_r4_core::resources::patient::{Patient, PatientMutators};
// Now all base traits are in scope
let patient = <Patient as PatientMutators>::new()
.set_id("example".to_string()) // from ResourceMutators
.set_active(true); // from PatientMutatorsThese improvements follow idiomatic Rust patterns used by popular crates like
serde, tokio, and diesel, making the generated code more ergonomic and
reducing the cognitive load on users.
Structs§
- File
Generator - File generator for organizing and writing generated code
Enums§
- Fhir
Type Category - Classification of FHIR types for organizing into appropriate directories