Skip to main content

Validate

Trait Validate 

Source
pub trait Validate {
    // Required method
    fn validate(&self) -> Vec<ValidationIssue>;

    // Provided method
    fn is_valid(&self) -> bool { ... }
}
Expand description

Types that can validate themselves against FHIR constraints.

Required Methods§

Source

fn validate(&self) -> Vec<ValidationIssue>

Return all validation issues; an empty vector means the value is valid.

Provided Methods§

Source

fn is_valid(&self) -> bool

Convenience: true when Validate::validate finds no issues.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Validate for String

A bare String (used by a few fields) carries no FHIR-level constraint here.

Source§

impl Validate for Value

Arbitrary embedded JSON (e.g. a contained resource) is not structurally validated here.

Source§

impl<T: ?Sized> Validate for PhantomData<T>

A zero-sized type marker (e.g. the phantom on Reference<T>) has nothing to validate.

Source§

impl<T: Validate> Validate for Box<T>

Source§

impl<T: Validate> Validate for Option<T>

Source§

impl<T: Validate> Validate for Vec1<T>

A non-empty Vec1 (used for FHIR 1..* elements) validates each element.

Source§

impl<T: Validate> Validate for Vec<T>

Implementors§

Source§

impl Validate for Decimal

Decimal validates its own lexeme (spec R2.6).

One impl for one shared type: were this written per release, compiling two releases together would be a conflicting-impl error.

Source§

impl<E> Validate for Coded<E>

Source§

impl<T: Validate> Validate for PrimVec<T>