pub struct ValidationTraitGenerator;Expand description
Generator for validation traits and implementations
Implementations§
Source§impl ValidationTraitGenerator
impl ValidationTraitGenerator
Sourcepub fn generate_trait_definition() -> String
pub fn generate_trait_definition() -> String
Generate the ValidatableResource trait definition
This trait provides access to invariants for validation purposes.
Example output:
ⓘ
pub trait ValidatableResource {
fn resource_type(&self) -> &'static str;
fn invariants() -> &'static [rh_foundation::Invariant];
fn bindings() -> &'static [rh_foundation::ElementBinding] {
&[]
}
fn profile_url() -> Option<&'static str> {
None
}
}Sourcepub fn generate_trait_impl(structure_def: &StructureDefinition) -> String
pub fn generate_trait_impl(structure_def: &StructureDefinition) -> String
Generate ValidatableResource trait implementation for a StructureDefinition
Only generates an implementation if the type has invariants or bindings.
Example output:
ⓘ
impl ValidatableResource for Patient {
fn resource_type(&self) -> &'static str {
"Patient"
}
fn invariants() -> &'static [rh_foundation::Invariant] {
&INVARIANTS
}
fn bindings() -> &'static [rh_foundation::ElementBinding] {
&BINDINGS
}
fn profile_url() -> Option<&'static str> {
Some("http://hl7.org/fhir/StructureDefinition/Patient")
}
}Sourcepub fn generate_validation_module() -> String
pub fn generate_validation_module() -> String
Generate the validation module file content
This creates the validation.rs file that contains the ValidatableResource trait.
Auto Trait Implementations§
impl Freeze for ValidationTraitGenerator
impl RefUnwindSafe for ValidationTraitGenerator
impl Send for ValidationTraitGenerator
impl Sync for ValidationTraitGenerator
impl Unpin for ValidationTraitGenerator
impl UnsafeUnpin for ValidationTraitGenerator
impl UnwindSafe for ValidationTraitGenerator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more