Skip to main content

fhir_core/
lib.rs

1//! Release-independent core for the FHIR crates.
2//!
3//! Everything here is the same for R3, R4, and R5: one `Decimal`, one
4//! `Validate` trait, one `Coded<E>`, one date/time parser, one XML reader,
5//! one REST client generic over [`release::Release`]. The release crates
6//! depend on this one and re-export its items under their own paths, so
7//! `fhir::r5::validate::Validate` and `fhir::r4::validate::Validate` are the
8//! *same* trait and a value from either release satisfies it.
9//!
10//! That sharing is the point. A `Validate` defined per release would make
11//! `impl Validate for T` non-portable across releases, and a `Decimal`
12//! generated three times would be three incompatible types for one FHIR
13//! primitive.
14//!
15//! This crate is not intended to be depended on directly; use `fhir`.
16
17// The doc comments here link to release items (`crate::r4::codes`) that live
18// in the release crates and are not visible from here. The links are correct
19// for readers of the `fhir` facade, where these modules are re-exported, so
20// they are kept rather than stripped.
21// A data model has no business dereferencing raw pointers (spec R13.14).
22#![forbid(unsafe_code)]
23#![allow(rustdoc::broken_intra_doc_links)]
24// FHIR prose contains bare specification URLs and `value[x]` notation.
25#![allow(rustdoc::bare_urls)]
26
27/// The FHIR `decimal` primitive, preserving the precision it was given.
28pub mod decimal;
29
30/// The value array of a repeating FHIR primitive (audit F-86).
31pub mod primvec;
32
33/// The [`Validate`](validate::Validate) trait and [`ValidationIssue`](validate::ValidationIssue).
34pub mod validate;
35
36/// The [`Coded<E>`](coded::Coded) wrapper for `required`-binding coded fields.
37pub mod coded;
38
39/// Support for the generated `#[derive(Builder)]` builders.
40pub mod builder;
41
42/// Per-element metadata types, queryable by FHIR path.
43pub mod meta;
44
45/// Parsing and precision-aware comparison for the date/time primitives.
46pub mod temporal;
47
48/// `_summary` element filtering.
49pub mod summary;
50
51/// The [`Release`](release::Release) trait each release crate implements.
52pub mod release;
53
54/// Converting a resource between releases, with an explicit loss report.
55pub mod convert;
56
57/// Shared helpers.
58pub mod util;
59
60/// XML reading and writing (feature `xml`).
61#[cfg(feature = "xml")]
62pub mod xml;
63
64/// An async FHIR REST client, generic over the release (feature `client`).
65#[cfg(feature = "client")]
66pub mod client;
67
68pub use primvec::PrimVec;