fhir_rs/datatype/base/
mod.rs1mod datetime;
2mod xhtml;
3
4use std::fmt::Debug;
5pub use datetime::*;
6pub use xhtml::Xhtml;
7
8use crate::prelude::Base;
9
10pub type Id = String;
11pub type Code = String;
12pub type Markdown = String;
13
14pub type Base64Binary = String;
15
16pub type Boolean = bool;
17pub type Uri = String;
18pub type Url = String;
19pub type Oid = String;
20pub type Uuid = String;
21pub type Canonical = String;
22pub type PositiveInt = usize;
23pub type UnsignedInt = usize;
24pub type Decimal = f64;
25pub type Integer = isize;
26pub type Integer64 = i64;
27
28macro_rules! base_impl {
29 (
30 $($ty: ident,)+
31 ) => {
32 $(
33 impl Base for $ty {
34 fn type_name(&self) -> &str { stringify!($ty) }
35 }
36 )+
37 };
38}
39
40base_impl!{String, Boolean, PositiveInt, Decimal, Integer, Integer64, DateTime, Date, Time, Instant, Xhtml,}
41
42impl<T: Debug> Base for Option<T> {
43 fn type_name(&self) -> &str {
47 "Option"
48 }
49}
50impl<T: Debug> Base for Vec<T> {
51 fn type_name(&self) -> &str {
55 "Vec"
56 }
57}
58impl<T: Debug> Base for Box<T> {
59 fn type_name(&self) -> &str {
60 "Box"
61 }
62}