1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
//! Macros to ease conditional code based on enabled features.
// Depending on the features not all macros are used.
#![allow(unused_macros)]
/// Feature `os-poll` enabled.
macro_rules! cfg_os_poll {
($($item:item)*) => {
$(
#[cfg(feature = "os-poll")]
#[cfg_attr(docsrs, doc(cfg(feature = "os-poll")))]
$item
)*
}
}
/// Feature `os-poll` disabled.
macro_rules! cfg_not_os_poll {
($($item:item)*) => {
$(
#[cfg(not(feature = "os-poll"))]
$item
)*
}
}
/// One of the `tcp`, `udp`, `uds` features enabled.
#[cfg(unix)]
macro_rules! cfg_net {
($($item:item)*) => {
$(
#[cfg(any(feature = "tcp", feature = "udp", feature = "uds"))]
#[cfg_attr(docsrs, doc(cfg(any(feature = "tcp", feature = "udp", feature = "uds"))))]
$item
)*
}
}
/// One of the `tcp`, `udp` features enabled.
#[cfg(windows)]
macro_rules! cfg_net {
($($item:item)*) => {
$(
#[cfg(any(feature = "tcp", feature = "udp"))]
#[cfg_attr(docsrs, doc(cfg(any(feature = "tcp", feature = "udp"))))]
$item
)*
}
}
/// Feature `tcp` enabled.
macro_rules! cfg_tcp {
($($item:item)*) => {
$(
#[cfg(feature = "tcp")]
#[cfg_attr(docsrs, doc(cfg(feature = "tcp")))]
$item
)*
}
}
/// Feature `udp` enabled.
macro_rules! cfg_udp {
($($item:item)*) => {
$(
#[cfg(feature = "udp")]
#[cfg_attr(docsrs, doc(cfg(feature = "udp")))]
$item
)*
}
}
/// Feature `uds` enabled.
#[cfg(unix)]
macro_rules! cfg_uds {
($($item:item)*) => {
$(
#[cfg(feature = "uds")]
#[cfg_attr(docsrs, doc(cfg(feature = "uds")))]
$item
)*
}
}
/// Feature `os-util` enabled, or one of the features that need `os-util`.
#[cfg(unix)]
macro_rules! cfg_any_os_util {
($($item:item)*) => {
$(
#[cfg(any(feature = "os-util", feature = "tcp", feature = "udp", feature = "uds"))]
#[cfg_attr(docsrs, doc(cfg(any(feature = "os-util", feature = "tcp", feature = "udp", feature = "uds"))))]
$item
)*
}
}
/// Feature `os-util` enabled, or one of the features that need `os-util`.
#[cfg(windows)]
macro_rules! cfg_any_os_util {
($($item:item)*) => {
$(
#[cfg(any(feature = "os-util", feature = "tcp", feature = "udp"))]
#[cfg_attr(docsrs, doc(cfg(any(feature = "os-util", feature = "tcp", feature = "udp"))))]
$item
)*
}
}
|