hyper/
cfg.rs

1macro_rules! cfg_feature {
2    (
3        #![$meta:meta]
4        $($item:item)*
5    ) => {
6        $(
7            #[cfg($meta)]
8            #[cfg_attr(docsrs, doc(cfg($meta)))]
9            $item
10        )*
11    }
12}
13
14macro_rules! cfg_proto {
15    ($($item:item)*) => {
16        cfg_feature! {
17            #![all(
18                any(feature = "http1", feature = "http2"),
19                any(feature = "client", feature = "server"),
20            )]
21            $($item)*
22        }
23    }
24}
25
26cfg_proto! {
27    macro_rules! cfg_client {
28        ($($item:item)*) => {
29            cfg_feature! {
30                #![feature = "client"]
31                $($item)*
32            }
33        }
34    }
35
36    macro_rules! cfg_server {
37        ($($item:item)*) => {
38            cfg_feature! {
39                #![feature = "server"]
40                $($item)*
41            }
42        }
43    }
44}