Skip to main content

FileGenerator

Struct FileGenerator 

Source
pub struct FileGenerator<'a> { /* private fields */ }
Expand description

File generator for organizing and writing generated code

Implementations§

Source§

impl<'a> FileGenerator<'a>

Source

pub fn new( config: &'a CodegenConfig, token_generator: &'a TokenGenerator, ) -> Self

Create a new file generator

Source

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

Generate a macros.rs file with all FHIR primitive macros

Source

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

Generate a lib.rs file for the generated crate

Source

pub fn generate_module_file<P: AsRef<Path>>( &self, module_dir: P, module_names: &[String], ) -> CodegenResult<()>

Generate module files (mod.rs) for organized directories

Source

pub fn generate_combined_primitives_file<P: AsRef<Path>>( &self, primitive_structure_defs: &[StructureDefinition], output_path: P, ) -> CodegenResult<()>

Generate a combined primitives.rs file with all FHIR primitive type aliases

Source

pub fn generate_to_organized_directories<P: AsRef<Path>>( &self, structure_def: &StructureDefinition, base_output_dir: P, rust_struct: &RustStruct, nested_structs: &[RustStruct], ) -> 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>>( &self, structure_def: &StructureDefinition, base_output_dir: P, rust_trait: &RustTrait, ) -> CodegenResult<()>

Generate a trait and write it 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>>( &self, structure_def: &StructureDefinition, output_path: P, rust_struct: &RustStruct, nested_structs: &[RustStruct], ) -> CodegenResult<()>

Generate a Rust struct and write it to a file

Source

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

Generate a Rust trait and write it to a file

Source

pub fn generate_traits_to_file<P: AsRef<Path>>( &self, _structure_def: &StructureDefinition, output_path: P, rust_traits: &[&RustTrait], ) -> CodegenResult<()>

Generate multiple traits to a single file

Source

pub fn generate_enum_files<P: AsRef<Path>>( &self, enums_dir: P, enum_generator: &EnumGenerator<'_>, ) -> 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, enum_generator: &EnumGenerator<'_>, ) -> CodegenResult<()>

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

Source

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

Generate a trait file directly from a RustTrait object

Source

pub fn generate_complete_crate<P: AsRef<Path>>( &self, output_dir: P, crate_name: &str, _structures: &[StructureDefinition], ) -> CodegenResult<()>

Generate a complete crate structure with all necessary files and modules

Auto Trait Implementations§

§

impl<'a> Freeze for FileGenerator<'a>

§

impl<'a> RefUnwindSafe for FileGenerator<'a>

§

impl<'a> Send for FileGenerator<'a>

§

impl<'a> Sync for FileGenerator<'a>

§

impl<'a> Unpin for FileGenerator<'a>

§

impl<'a> UnsafeUnpin for FileGenerator<'a>

§

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