smart_config/de/
macros.rs1#[doc(hidden)]
2#[macro_export]
3macro_rules! _basic_types {
4 (@expand bool $($tail:tt)+) => {
5 $crate::metadata::BasicTypes::BOOL.or($crate::_basic_types!($($tail)+))
6 };
7 (@expand int $($tail:tt)+) => {
8 $crate::metadata::BasicTypes::INTEGER.or($crate::_basic_types!(@expand $($tail)+))
9 };
10 (@expand float $($tail:tt)+) => {
11 $crate::metadata::BasicTypes::FLOAT.or($crate::_basic_types!(@expand $($tail)+))
12 };
13 (@expand str $($tail:tt)+) => {
14 $crate::metadata::BasicTypes::STRING.or($crate::_basic_types!(@expand $($tail)+))
15 };
16 (@expand array $($tail:tt)+) => {
17 $crate::metadata::BasicTypes::ARRAY.or($crate::_basic_types!(@expand $($tail)+))
18 };
19 (@expand object $($tail:tt)+) => {
20 $crate::metadata::BasicTypes::OBJECT.or($crate::_basic_types!(@expand $($tail)+))
21 };
22
23 (@expand bool) => {
24 $crate::metadata::BasicTypes::BOOL
25 };
26 (@expand int) => {
27 $crate::metadata::BasicTypes::INTEGER
28 };
29 (@expand float) => {
30 $crate::metadata::BasicTypes::FLOAT
31 };
32 (@expand str) => {
33 $crate::metadata::BasicTypes::STRING
34 };
35 (@expand array) => {
36 $crate::metadata::BasicTypes::ARRAY
37 };
38 (@expand object) => {
39 $crate::metadata::BasicTypes::OBJECT
40 };
41
42 ($($expecting:tt)+) => {
43 $crate::metadata::BasicTypes::raw($crate::_basic_types!(@expand $($expecting)+))
44 };
45}
46
47#[macro_export]
87#[allow(non_snake_case)]
88macro_rules! Serde {
89 (*) => {
90 $crate::de::Serde::<{ $crate::metadata::BasicTypes::ANY.raw() }>
91 };
92 ($($expecting:tt),+ $(,)?) => {
93 $crate::de::Serde::<{ $crate::_basic_types!($($expecting)+) }>
94 };
95}
96
97pub use Serde;