Skip to main content

CodeGenerator

Struct CodeGenerator 

Source
pub struct CodeGenerator { /* private fields */ }
Expand description

Main code generator struct that orchestrates specialized generators

Implementations§

Source§

impl CodeGenerator

Source

pub fn new(config: CodegenConfig) -> Self

Create a new code generator with the given configuration

Source

pub fn new_with_value_set_directory<P: AsRef<Path>>( config: CodegenConfig, value_set_dir: P, ) -> Self

Create a new code generator with a ValueSet directory

Source

pub fn load_structure_definition<P: AsRef<Path>>( &self, path: P, ) -> CodegenResult<StructureDefinition>

Load and parse a FHIR StructureDefinition from a JSON file

Source

pub fn generate_struct( &mut self, structure_def: &StructureDefinition, ) -> CodegenResult<RustStruct>

Generate a Rust struct from a FHIR StructureDefinition

Source

pub fn generate_trait( &mut self, structure_def: &StructureDefinition, ) -> CodegenResult<Vec<RustTrait>>

Generate traits for a structure definition

Source

pub fn generate_to_organized_directories<P: AsRef<Path>>( &mut self, structure_def: &StructureDefinition, base_output_dir: P, ) -> CodegenResult<()>

Generate a Rust struct and write it to the appropriate directory based on FHIR type classification

Source

pub fn generate_trait_to_organized_directory<P: AsRef<Path>>( &mut self, structure_def: &StructureDefinition, base_output_dir: P, ) -> CodegenResult<()>

Generate traits and write them to the traits directory

Source

pub fn classify_fhir_structure_def( &self, structure_def: &StructureDefinition, ) -> FhirTypeCategory

Classify a FHIR StructureDefinition into the appropriate category

Source

pub fn generate_to_file<P: AsRef<Path>>( &mut self, structure_def: &StructureDefinition, output_path: P, ) -> CodegenResult<()>

Generate a Rust struct and write it to a file

Source

pub fn generate_trait_to_file<P: AsRef<Path>>( &mut self, structure_def: &StructureDefinition, output_path: P, ) -> CodegenResult<()>

Generate a Rust trait and write it to a file

Source

pub fn pre_register_value_set_enums<P: AsRef<Path>>( &mut self, package_dir: P, ) -> CodegenResult<()>

Pre-scan and register all ValueSet enums in the TypeRegistry This should be called before processing resources to ensure correct import paths

Source

pub fn generate_enum_files<P: AsRef<Path>>( &mut self, enums_dir: P, ) -> CodegenResult<()>

Generate all ValueSet enums to separate files in the specified directory

Source

pub fn generate_enums_mod_file<P: AsRef<Path>>( &self, enums_dir: P, ) -> CodegenResult<()>

Generate a mod.rs file that re-exports all the enum modules

Source

pub fn generate_enum_for_value_set( &mut self, value_set_url: &str, ) -> CodegenResult<Option<RustEnum>>

Generate an enum for a value set binding

Source

pub fn has_cached_enums(&self) -> bool

Check if any ValueSet enums have been generated

Source

pub fn to_filename(&self, structure_def: &StructureDefinition) -> String

Convert a FHIR resource type name to filename using snake_case

Source

pub fn generate_trait_file_from_trait<P: AsRef<Path>>( &self, rust_trait: &RustTrait, output_path: P, ) -> CodegenResult<()>

Generate a comprehensive Resource trait with common FHIR resource methods Generate a trait file directly from a RustTrait object

Auto Trait Implementations§

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

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

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,