k8s_openapi/mnt/build/debug/build/k8s-openapi-c355e9a91c06af1f/out/
conditional_compilation_macros.rs

1/// This macro evaluates to its contents if the `v1_30` feature is enabled, otherwise it evaluates to nothing.
2///
3/// # Examples
4///
5/// ```rust
6/// # #[macro_use] extern crate k8s_openapi;
7/// k8s_if_1_30! {
8///     use k8s_openapi::api::core::v1 as api;
9/// }
10/// ```
11#[macro_export] macro_rules! k8s_if_1_30 { ($($tt:tt)*) => { }; }
12
13/// This macro evaluates to its contents if the `v1_30` or higher feature is enabled, otherwise it evaluates to nothing.
14#[macro_export] macro_rules! k8s_if_ge_1_30 { ($($tt:tt)*) => { $($tt)* }; }
15
16/// This macro evaluates to its contents if the `v1_30` or lower feature is enabled, otherwise it evaluates to nothing.
17#[macro_export] macro_rules! k8s_if_le_1_30 { ($($tt:tt)*) => { }; }
18
19/// This macro evaluates to its contents if the `v1_31` feature is enabled, otherwise it evaluates to nothing.
20///
21/// # Examples
22///
23/// ```rust
24/// # #[macro_use] extern crate k8s_openapi;
25/// k8s_if_1_31! {
26///     use k8s_openapi::api::core::v1 as api;
27/// }
28/// ```
29#[macro_export] macro_rules! k8s_if_1_31 { ($($tt:tt)*) => { $($tt)* }; }
30
31/// This macro evaluates to its contents if the `v1_31` or higher feature is enabled, otherwise it evaluates to nothing.
32#[macro_export] macro_rules! k8s_if_ge_1_31 { ($($tt:tt)*) => { $($tt)* }; }
33
34/// This macro evaluates to its contents if the `v1_31` or lower feature is enabled, otherwise it evaluates to nothing.
35#[macro_export] macro_rules! k8s_if_le_1_31 { ($($tt:tt)*) => { $($tt)* }; }
36
37/// This macro evaluates to its contents if the `v1_32` feature is enabled, otherwise it evaluates to nothing.
38///
39/// # Examples
40///
41/// ```rust
42/// # #[macro_use] extern crate k8s_openapi;
43/// k8s_if_1_32! {
44///     use k8s_openapi::api::core::v1 as api;
45/// }
46/// ```
47#[macro_export] macro_rules! k8s_if_1_32 { ($($tt:tt)*) => { }; }
48
49/// This macro evaluates to its contents if the `v1_32` or higher feature is enabled, otherwise it evaluates to nothing.
50#[macro_export] macro_rules! k8s_if_ge_1_32 { ($($tt:tt)*) => { }; }
51
52/// This macro evaluates to its contents if the `v1_32` or lower feature is enabled, otherwise it evaluates to nothing.
53#[macro_export] macro_rules! k8s_if_le_1_32 { ($($tt:tt)*) => { $($tt)* }; }
54
55/// This macro evaluates to its contents if the `v1_33` feature is enabled, otherwise it evaluates to nothing.
56///
57/// # Examples
58///
59/// ```rust
60/// # #[macro_use] extern crate k8s_openapi;
61/// k8s_if_1_33! {
62///     use k8s_openapi::api::core::v1 as api;
63/// }
64/// ```
65#[macro_export] macro_rules! k8s_if_1_33 { ($($tt:tt)*) => { }; }
66
67/// This macro evaluates to its contents if the `v1_33` or higher feature is enabled, otherwise it evaluates to nothing.
68#[macro_export] macro_rules! k8s_if_ge_1_33 { ($($tt:tt)*) => { }; }
69
70/// This macro evaluates to its contents if the `v1_33` or lower feature is enabled, otherwise it evaluates to nothing.
71#[macro_export] macro_rules! k8s_if_le_1_33 { ($($tt:tt)*) => { $($tt)* }; }
72
73/// This macro evaluates to its contents if the `v1_34` feature is enabled, otherwise it evaluates to nothing.
74///
75/// # Examples
76///
77/// ```rust
78/// # #[macro_use] extern crate k8s_openapi;
79/// k8s_if_1_34! {
80///     use k8s_openapi::api::core::v1 as api;
81/// }
82/// ```
83#[macro_export] macro_rules! k8s_if_1_34 { ($($tt:tt)*) => { }; }
84
85/// This macro evaluates to its contents if the `v1_34` or higher feature is enabled, otherwise it evaluates to nothing.
86#[macro_export] macro_rules! k8s_if_ge_1_34 { ($($tt:tt)*) => { }; }
87
88/// This macro evaluates to its contents if the `v1_34` or lower feature is enabled, otherwise it evaluates to nothing.
89#[macro_export] macro_rules! k8s_if_le_1_34 { ($($tt:tt)*) => { $($tt)* }; }
90
91/// A macro that emits a `match` expr with the given test expression and arms.
92/// The match arms can be annotated with the other conditional compilation macros in this crate so that they're only emitted
93/// if the predicate is true.
94#[macro_export] macro_rules! k8s_match {
95    (@inner { $test:expr } { $($arms:tt)* } { }) => {
96        match $test { $($arms)* }
97    };
98
99    (@inner { $test:expr } { $($arms:tt)* } { k8s_if_1_30!($($arm:tt)*), $($rest:tt)* }) => {
100        k8s_match!(@inner { $test } { $($arms)* } { $($rest)* })
101    };
102    (@inner { $test:expr } { $($arms:tt)* } { k8s_if_ge_1_30!($($arm:tt)*), $($rest:tt)* }) => {
103        k8s_match!(@inner { $test } { $($arms)* } { $($arm)*, $($rest)* })
104    };
105    (@inner { $test:expr } { $($arms:tt)* } { k8s_if_le_1_30!($($arm:tt)*), $($rest:tt)* }) => {
106        k8s_match!(@inner { $test } { $($arms)* } { $($rest)* })
107    };
108
109    (@inner { $test:expr } { $($arms:tt)* } { k8s_if_1_31!($($arm:tt)*), $($rest:tt)* }) => {
110        k8s_match!(@inner { $test } { $($arms)* } { $($arm)*, $($rest)* })
111    };
112    (@inner { $test:expr } { $($arms:tt)* } { k8s_if_ge_1_31!($($arm:tt)*), $($rest:tt)* }) => {
113        k8s_match!(@inner { $test } { $($arms)* } { $($arm)*, $($rest)* })
114    };
115    (@inner { $test:expr } { $($arms:tt)* } { k8s_if_le_1_31!($($arm:tt)*), $($rest:tt)* }) => {
116        k8s_match!(@inner { $test } { $($arms)* } { $($arm)*, $($rest)* })
117    };
118
119    (@inner { $test:expr } { $($arms:tt)* } { k8s_if_1_32!($($arm:tt)*), $($rest:tt)* }) => {
120        k8s_match!(@inner { $test } { $($arms)* } { $($rest)* })
121    };
122    (@inner { $test:expr } { $($arms:tt)* } { k8s_if_ge_1_32!($($arm:tt)*), $($rest:tt)* }) => {
123        k8s_match!(@inner { $test } { $($arms)* } { $($rest)* })
124    };
125    (@inner { $test:expr } { $($arms:tt)* } { k8s_if_le_1_32!($($arm:tt)*), $($rest:tt)* }) => {
126        k8s_match!(@inner { $test } { $($arms)* } { $($arm)*, $($rest)* })
127    };
128
129    (@inner { $test:expr } { $($arms:tt)* } { k8s_if_1_33!($($arm:tt)*), $($rest:tt)* }) => {
130        k8s_match!(@inner { $test } { $($arms)* } { $($rest)* })
131    };
132    (@inner { $test:expr } { $($arms:tt)* } { k8s_if_ge_1_33!($($arm:tt)*), $($rest:tt)* }) => {
133        k8s_match!(@inner { $test } { $($arms)* } { $($rest)* })
134    };
135    (@inner { $test:expr } { $($arms:tt)* } { k8s_if_le_1_33!($($arm:tt)*), $($rest:tt)* }) => {
136        k8s_match!(@inner { $test } { $($arms)* } { $($arm)*, $($rest)* })
137    };
138
139    (@inner { $test:expr } { $($arms:tt)* } { k8s_if_1_34!($($arm:tt)*), $($rest:tt)* }) => {
140        k8s_match!(@inner { $test } { $($arms)* } { $($rest)* })
141    };
142    (@inner { $test:expr } { $($arms:tt)* } { k8s_if_ge_1_34!($($arm:tt)*), $($rest:tt)* }) => {
143        k8s_match!(@inner { $test } { $($arms)* } { $($rest)* })
144    };
145    (@inner { $test:expr } { $($arms:tt)* } { k8s_if_le_1_34!($($arm:tt)*), $($rest:tt)* }) => {
146        k8s_match!(@inner { $test } { $($arms)* } { $($arm)*, $($rest)* })
147    };
148
149    (@inner { $test:expr } { $($arms:tt)* } { $next_pat:pat $(if $cond:expr)? => $next_expr:expr, $($rest:tt)* }) => {
150        k8s_match!(@inner { $test } { $($arms)* $next_pat $(if $cond)? => $next_expr, } { $($rest)* })
151    };
152
153    ($test:expr, { $($rest:tt)* }) => {
154        k8s_match!(@inner { $test } { } { $($rest)* })
155    };
156}