Skip to main content

FieldGenerator

Struct FieldGenerator 

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

Generator for creating Rust fields from FHIR ElementDefinitions

Implementations§

Source§

impl<'a> FieldGenerator<'a>

Source

pub fn new( config: &'a CodegenConfig, type_cache: &'a HashMap<String, RustStruct>, value_set_manager: &'a mut ValueSetManager, ) -> Self

Create a new field generator

Source

pub fn create_fields_from_element( &mut self, element: &ElementDefinition, ) -> CodegenResult<Vec<RustField>>

Create RustField(s) from an ElementDefinition Returns a vector because choice types generate multiple fields

Source

pub fn create_field_from_element( &mut self, element: &ElementDefinition, ) -> CodegenResult<Option<RustField>>

Legacy method for backward compatibility

Source

pub fn to_rust_field_name(name: &str) -> String

Convert a FHIR field name to a valid Rust field name

Source

pub fn type_code_to_snake_case(type_code: &str) -> String

Convert FHIR type code to snake_case for field suffix

Source

pub fn extract_field_name_from_path(path: &str) -> &str

Extract field name from element path (utility method)

Source

pub fn requires_serde_rename(original_name: &str, rust_field_name: &str) -> bool

Check if a field name requires serde rename

Source

pub fn determine_field_cardinality(element: &ElementDefinition) -> (bool, bool)

Determine field cardinality from ElementDefinition

Source

pub fn extract_choice_types_from_structure( structure_def: &StructureDefinition, ) -> Vec<(String, Vec<String>)>

Extract choice type information from a StructureDefinition Returns a vector of (base_name, type_codes) tuples for each choice type found

Source

pub fn create_primitive_field_macro_call( &mut self, element: &ElementDefinition, ) -> CodegenResult<Option<RustField>>

Generate explicit primitive fields with companion extension fields This creates two RustField instances: the primitive field and its companion Element field

Source

pub fn create_companion_extension_field( &self, field_name: &str, ) -> CodegenResult<RustField>

Generate the companion extension field for a primitive field Returns a RustField representing the _fieldname extension companion

Auto Trait Implementations§

§

impl<'a> Freeze for FieldGenerator<'a>

§

impl<'a> RefUnwindSafe for FieldGenerator<'a>

§

impl<'a> Send for FieldGenerator<'a>

§

impl<'a> Sync for FieldGenerator<'a>

§

impl<'a> Unpin for FieldGenerator<'a>

§

impl<'a> UnsafeUnpin for FieldGenerator<'a>

§

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