1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//! Support for the generated resource/datatype builders.
//!
//! `#[derive(fhir_derive_macros::Builder)]` generates a `<Type>Builder` with a
//! chainable setter per field and a `build()` that returns
//! [`Result<T, BuilderError>`], failing if a required (`1..1`) field was not set.
//! Optional (`0..1`) and repeating fields default to absent/empty.
//!
//! The error type is release-independent, so it is defined once here and
//! re-exported as [`r4::builder`](crate::r4::builder) and
//! [`r5::builder`](crate::r5::builder); see those modules for worked examples.
//!
//! ```
//! use fhir::builder::BuilderError;
//!
//! let err = BuilderError::missing("status");
//! assert_eq!(err.missing_field, "status");
//! assert_eq!(err.to_string(), "required field `status` was not set");
//! ```
use fmt;
/// Error returned by a builder's `build()` when a required field is missing.