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

1/// This macro evaluates to its contents if the `v1_24` 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_24! {
8///     use k8s_openapi::api::core::v1 as api;
9/// }
10/// ```
11#[macro_export] macro_rules! k8s_if_1_24 { ($($tt:tt)*) => { }; }
12
13/// This macro evaluates to its contents if the `v1_24` or higher feature is enabled, otherwise it evaluates to nothing.
14#[macro_export] macro_rules! k8s_if_ge_1_24 { ($($tt:tt)*) => { $($tt)* }; }
15
16/// This macro evaluates to its contents if the `v1_24` or lower feature is enabled, otherwise it evaluates to nothing.
17#[macro_export] macro_rules! k8s_if_le_1_24 { ($($tt:tt)*) => { }; }
18
19/// This macro evaluates to its contents if the `v1_25` 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_25! {
26///     use k8s_openapi::api::core::v1 as api;
27/// }
28/// ```
29#[macro_export] macro_rules! k8s_if_1_25 { ($($tt:tt)*) => { }; }
30
31/// This macro evaluates to its contents if the `v1_25` or higher feature is enabled, otherwise it evaluates to nothing.
32#[macro_export] macro_rules! k8s_if_ge_1_25 { ($($tt:tt)*) => { $($tt)* }; }
33
34/// This macro evaluates to its contents if the `v1_25` or lower feature is enabled, otherwise it evaluates to nothing.
35#[macro_export] macro_rules! k8s_if_le_1_25 { ($($tt:tt)*) => { }; }
36
37/// This macro evaluates to its contents if the `v1_26` 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_26! {
44///     use k8s_openapi::api::core::v1 as api;
45/// }
46/// ```
47#[macro_export] macro_rules! k8s_if_1_26 { ($($tt:tt)*) => { }; }
48
49/// This macro evaluates to its contents if the `v1_26` or higher feature is enabled, otherwise it evaluates to nothing.
50#[macro_export] macro_rules! k8s_if_ge_1_26 { ($($tt:tt)*) => { $($tt)* }; }
51
52/// This macro evaluates to its contents if the `v1_26` or lower feature is enabled, otherwise it evaluates to nothing.
53#[macro_export] macro_rules! k8s_if_le_1_26 { ($($tt:tt)*) => { }; }
54
55/// This macro evaluates to its contents if the `v1_27` 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_27! {
62///     use k8s_openapi::api::core::v1 as api;
63/// }
64/// ```
65#[macro_export] macro_rules! k8s_if_1_27 { ($($tt:tt)*) => { }; }
66
67/// This macro evaluates to its contents if the `v1_27` or higher feature is enabled, otherwise it evaluates to nothing.
68#[macro_export] macro_rules! k8s_if_ge_1_27 { ($($tt:tt)*) => { $($tt)* }; }
69
70/// This macro evaluates to its contents if the `v1_27` or lower feature is enabled, otherwise it evaluates to nothing.
71#[macro_export] macro_rules! k8s_if_le_1_27 { ($($tt:tt)*) => { }; }
72
73/// This macro evaluates to its contents if the `v1_28` 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_28! {
80///     use k8s_openapi::api::core::v1 as api;
81/// }
82/// ```
83#[macro_export] macro_rules! k8s_if_1_28 { ($($tt:tt)*) => { }; }
84
85/// This macro evaluates to its contents if the `v1_28` or higher feature is enabled, otherwise it evaluates to nothing.
86#[macro_export] macro_rules! k8s_if_ge_1_28 { ($($tt:tt)*) => { $($tt)* }; }
87
88/// This macro evaluates to its contents if the `v1_28` or lower feature is enabled, otherwise it evaluates to nothing.
89#[macro_export] macro_rules! k8s_if_le_1_28 { ($($tt:tt)*) => { }; }
90
91/// This macro evaluates to its contents if the `v1_29` feature is enabled, otherwise it evaluates to nothing.
92///
93/// # Examples
94///
95/// ```rust
96/// # #[macro_use] extern crate k8s_openapi;
97/// k8s_if_1_29! {
98///     use k8s_openapi::api::core::v1 as api;
99/// }
100/// ```
101#[macro_export] macro_rules! k8s_if_1_29 { ($($tt:tt)*) => { }; }
102
103/// This macro evaluates to its contents if the `v1_29` or higher feature is enabled, otherwise it evaluates to nothing.
104#[macro_export] macro_rules! k8s_if_ge_1_29 { ($($tt:tt)*) => { $($tt)* }; }
105
106/// This macro evaluates to its contents if the `v1_29` or lower feature is enabled, otherwise it evaluates to nothing.
107#[macro_export] macro_rules! k8s_if_le_1_29 { ($($tt:tt)*) => { }; }
108
109/// This macro evaluates to its contents if the `v1_30` feature is enabled, otherwise it evaluates to nothing.
110///
111/// # Examples
112///
113/// ```rust
114/// # #[macro_use] extern crate k8s_openapi;
115/// k8s_if_1_30! {
116///     use k8s_openapi::api::core::v1 as api;
117/// }
118/// ```
119#[macro_export] macro_rules! k8s_if_1_30 { ($($tt:tt)*) => { $($tt)* }; }
120
121/// This macro evaluates to its contents if the `v1_30` or higher feature is enabled, otherwise it evaluates to nothing.
122#[macro_export] macro_rules! k8s_if_ge_1_30 { ($($tt:tt)*) => { $($tt)* }; }
123
124/// This macro evaluates to its contents if the `v1_30` or lower feature is enabled, otherwise it evaluates to nothing.
125#[macro_export] macro_rules! k8s_if_le_1_30 { ($($tt:tt)*) => { $($tt)* }; }
126
127/// A macro that emits a `match` expr with the given test expression and arms.
128/// The match arms can be annotated with the other conditional compilation macros in this crate so that they're only emitted
129/// if the predicate is true.
130#[macro_export] macro_rules! k8s_match {
131    (@inner { $test:expr } { $($arms:tt)* } { }) => {
132        match $test { $($arms)* }
133    };
134
135    (@inner { $test:expr } { $($arms:tt)* } { k8s_if_1_24!($($arm:tt)*), $($rest:tt)* }) => {
136        k8s_match!(@inner { $test } { $($arms)* } { $($rest)* })
137    };
138    (@inner { $test:expr } { $($arms:tt)* } { k8s_if_ge_1_24!($($arm:tt)*), $($rest:tt)* }) => {
139        k8s_match!(@inner { $test } { $($arms)* } { $($arm)*, $($rest)* })
140    };
141    (@inner { $test:expr } { $($arms:tt)* } { k8s_if_le_1_24!($($arm:tt)*), $($rest:tt)* }) => {
142        k8s_match!(@inner { $test } { $($arms)* } { $($rest)* })
143    };
144
145    (@inner { $test:expr } { $($arms:tt)* } { k8s_if_1_25!($($arm:tt)*), $($rest:tt)* }) => {
146        k8s_match!(@inner { $test } { $($arms)* } { $($rest)* })
147    };
148    (@inner { $test:expr } { $($arms:tt)* } { k8s_if_ge_1_25!($($arm:tt)*), $($rest:tt)* }) => {
149        k8s_match!(@inner { $test } { $($arms)* } { $($arm)*, $($rest)* })
150    };
151    (@inner { $test:expr } { $($arms:tt)* } { k8s_if_le_1_25!($($arm:tt)*), $($rest:tt)* }) => {
152        k8s_match!(@inner { $test } { $($arms)* } { $($rest)* })
153    };
154
155    (@inner { $test:expr } { $($arms:tt)* } { k8s_if_1_26!($($arm:tt)*), $($rest:tt)* }) => {
156        k8s_match!(@inner { $test } { $($arms)* } { $($rest)* })
157    };
158    (@inner { $test:expr } { $($arms:tt)* } { k8s_if_ge_1_26!($($arm:tt)*), $($rest:tt)* }) => {
159        k8s_match!(@inner { $test } { $($arms)* } { $($arm)*, $($rest)* })
160    };
161    (@inner { $test:expr } { $($arms:tt)* } { k8s_if_le_1_26!($($arm:tt)*), $($rest:tt)* }) => {
162        k8s_match!(@inner { $test } { $($arms)* } { $($rest)* })
163    };
164
165    (@inner { $test:expr } { $($arms:tt)* } { k8s_if_1_27!($($arm:tt)*), $($rest:tt)* }) => {
166        k8s_match!(@inner { $test } { $($arms)* } { $($rest)* })
167    };
168    (@inner { $test:expr } { $($arms:tt)* } { k8s_if_ge_1_27!($($arm:tt)*), $($rest:tt)* }) => {
169        k8s_match!(@inner { $test } { $($arms)* } { $($arm)*, $($rest)* })
170    };
171    (@inner { $test:expr } { $($arms:tt)* } { k8s_if_le_1_27!($($arm:tt)*), $($rest:tt)* }) => {
172        k8s_match!(@inner { $test } { $($arms)* } { $($rest)* })
173    };
174
175    (@inner { $test:expr } { $($arms:tt)* } { k8s_if_1_28!($($arm:tt)*), $($rest:tt)* }) => {
176        k8s_match!(@inner { $test } { $($arms)* } { $($rest)* })
177    };
178    (@inner { $test:expr } { $($arms:tt)* } { k8s_if_ge_1_28!($($arm:tt)*), $($rest:tt)* }) => {
179        k8s_match!(@inner { $test } { $($arms)* } { $($arm)*, $($rest)* })
180    };
181    (@inner { $test:expr } { $($arms:tt)* } { k8s_if_le_1_28!($($arm:tt)*), $($rest:tt)* }) => {
182        k8s_match!(@inner { $test } { $($arms)* } { $($rest)* })
183    };
184
185    (@inner { $test:expr } { $($arms:tt)* } { k8s_if_1_29!($($arm:tt)*), $($rest:tt)* }) => {
186        k8s_match!(@inner { $test } { $($arms)* } { $($rest)* })
187    };
188    (@inner { $test:expr } { $($arms:tt)* } { k8s_if_ge_1_29!($($arm:tt)*), $($rest:tt)* }) => {
189        k8s_match!(@inner { $test } { $($arms)* } { $($arm)*, $($rest)* })
190    };
191    (@inner { $test:expr } { $($arms:tt)* } { k8s_if_le_1_29!($($arm:tt)*), $($rest:tt)* }) => {
192        k8s_match!(@inner { $test } { $($arms)* } { $($rest)* })
193    };
194
195    (@inner { $test:expr } { $($arms:tt)* } { k8s_if_1_30!($($arm:tt)*), $($rest:tt)* }) => {
196        k8s_match!(@inner { $test } { $($arms)* } { $($arm)*, $($rest)* })
197    };
198    (@inner { $test:expr } { $($arms:tt)* } { k8s_if_ge_1_30!($($arm:tt)*), $($rest:tt)* }) => {
199        k8s_match!(@inner { $test } { $($arms)* } { $($arm)*, $($rest)* })
200    };
201    (@inner { $test:expr } { $($arms:tt)* } { k8s_if_le_1_30!($($arm:tt)*), $($rest:tt)* }) => {
202        k8s_match!(@inner { $test } { $($arms)* } { $($arm)*, $($rest)* })
203    };
204
205    (@inner { $test:expr } { $($arms:tt)* } { $next_pat:pat $(if $cond:expr)? => $next_expr:expr, $($rest:tt)* }) => {
206        k8s_match!(@inner { $test } { $($arms)* $next_pat $(if $cond)? => $next_expr, } { $($rest)* })
207    };
208
209    ($test:expr, { $($rest:tt)* }) => {
210        k8s_match!(@inner { $test } { } { $($rest)* })
211    };
212}