1 #![allow(unused_macros)] 2 3 macro_rules! feature { 4 ( 5 #![$meta:meta] 6 $($item:item)* 7 ) => { 8 $( 9 #[cfg($meta)] 10 #[cfg_attr(docsrs, doc(cfg($meta)))] 11 $item 12 )* 13 } 14 } 15 16 /// Enables enter::block_on 17 macro_rules! cfg_block_on { 18 ($($item:item)*) => { 19 $( 20 #[cfg(any( 21 feature = "fs", 22 feature = "net", 23 feature = "io-std", 24 feature = "rt", 25 ))] 26 $item 27 )* 28 } 29 } 30 31 /// Enables internal `AtomicWaker` impl 32 macro_rules! cfg_atomic_waker_impl { 33 ($($item:item)*) => { 34 $( 35 #[cfg(any( 36 feature = "net", 37 feature = "process", 38 feature = "rt", 39 feature = "signal", 40 feature = "time", 41 ))] 42 #[cfg(not(loom))] 43 $item 44 )* 45 } 46 } 47 48 macro_rules! cfg_fs { 49 ($($item:item)*) => { 50 $( 51 #[cfg(feature = "fs")] 52 #[cfg_attr(docsrs, doc(cfg(feature = "fs")))] 53 $item 54 )* 55 } 56 } 57 58 macro_rules! cfg_io_blocking { 59 ($($item:item)*) => { 60 $( #[cfg(any(feature = "io-std", feature = "fs"))] $item )* 61 } 62 } 63 64 macro_rules! cfg_io_driver { 65 ($($item:item)*) => { 66 $( 67 #[cfg(any( 68 feature = "net", 69 feature = "process", 70 all(unix, feature = "signal"), 71 ))] 72 #[cfg_attr(docsrs, doc(cfg(any( 73 feature = "net", 74 feature = "process", 75 all(unix, feature = "signal"), 76 ))))] 77 $item 78 )* 79 } 80 } 81 82 macro_rules! cfg_io_driver_impl { 83 ( $( $item:item )* ) => { 84 $( 85 #[cfg(any( 86 feature = "net", 87 feature = "process", 88 all(unix, feature = "signal"), 89 ))] 90 $item 91 )* 92 } 93 } 94 95 macro_rules! cfg_not_io_driver { 96 ($($item:item)*) => { 97 $( 98 #[cfg(not(any( 99 feature = "net", 100 feature = "process", 101 all(unix, feature = "signal"), 102 )))] 103 $item 104 )* 105 } 106 } 107 108 macro_rules! cfg_io_readiness { 109 ($($item:item)*) => { 110 $( 111 #[cfg(feature = "net")] 112 $item 113 )* 114 } 115 } 116 117 macro_rules! cfg_io_std { 118 ($($item:item)*) => { 119 $( 120 #[cfg(feature = "io-std")] 121 #[cfg_attr(docsrs, doc(cfg(feature = "io-std")))] 122 $item 123 )* 124 } 125 } 126 127 macro_rules! cfg_io_util { 128 ($($item:item)*) => { 129 $( 130 #[cfg(feature = "io-util")] 131 #[cfg_attr(docsrs, doc(cfg(feature = "io-util")))] 132 $item 133 )* 134 } 135 } 136 137 macro_rules! cfg_not_io_util { 138 ($($item:item)*) => { 139 $( #[cfg(not(feature = "io-util"))] $item )* 140 } 141 } 142 143 macro_rules! cfg_loom { 144 ($($item:item)*) => { 145 $( #[cfg(loom)] $item )* 146 } 147 } 148 149 macro_rules! cfg_not_loom { 150 ($($item:item)*) => { 151 $( #[cfg(not(loom))] $item )* 152 } 153 } 154 155 macro_rules! cfg_macros { 156 ($($item:item)*) => { 157 $( 158 #[cfg(feature = "macros")] 159 #[cfg_attr(docsrs, doc(cfg(feature = "macros")))] 160 #[doc(inline)] 161 $item 162 )* 163 } 164 } 165 166 macro_rules! cfg_net { 167 ($($item:item)*) => { 168 $( 169 #[cfg(feature = "net")] 170 #[cfg_attr(docsrs, doc(cfg(feature = "net")))] 171 $item 172 )* 173 } 174 } 175 176 macro_rules! cfg_net_unix { 177 ($($item:item)*) => { 178 $( 179 #[cfg(all(unix, feature = "net"))] 180 #[cfg_attr(docsrs, doc(cfg(feature = "net")))] 181 $item 182 )* 183 } 184 } 185 186 macro_rules! cfg_process { 187 ($($item:item)*) => { 188 $( 189 #[cfg(feature = "process")] 190 #[cfg_attr(docsrs, doc(cfg(feature = "process")))] 191 #[cfg(not(loom))] 192 $item 193 )* 194 } 195 } 196 197 macro_rules! cfg_process_driver { 198 ($($item:item)*) => { 199 #[cfg(unix)] 200 #[cfg(not(loom))] 201 cfg_process! { $($item)* } 202 } 203 } 204 205 macro_rules! cfg_not_process_driver { 206 ($($item:item)*) => { 207 $( 208 #[cfg(not(all(unix, not(loom), feature = "process")))] 209 $item 210 )* 211 } 212 } 213 214 macro_rules! cfg_signal { 215 ($($item:item)*) => { 216 $( 217 #[cfg(feature = "signal")] 218 #[cfg_attr(docsrs, doc(cfg(feature = "signal")))] 219 #[cfg(not(loom))] 220 $item 221 )* 222 } 223 } 224 225 macro_rules! cfg_signal_internal { 226 ($($item:item)*) => { 227 $( 228 #[cfg(any(feature = "signal", all(unix, feature = "process")))] 229 #[cfg(not(loom))] 230 $item 231 )* 232 } 233 } 234 235 macro_rules! cfg_not_signal_internal { 236 ($($item:item)*) => { 237 $( 238 #[cfg(any(loom, not(unix), not(any(feature = "signal", all(unix, feature = "process")))))] 239 $item 240 )* 241 } 242 } 243 244 macro_rules! cfg_sync { 245 ($($item:item)*) => { 246 $( 247 #[cfg(feature = "sync")] 248 #[cfg_attr(docsrs, doc(cfg(feature = "sync")))] 249 $item 250 )* 251 } 252 } 253 254 macro_rules! cfg_not_sync { 255 ($($item:item)*) => { 256 $( #[cfg(not(feature = "sync"))] $item )* 257 } 258 } 259 260 macro_rules! cfg_rt { 261 ($($item:item)*) => { 262 $( 263 #[cfg(feature = "rt")] 264 #[cfg_attr(docsrs, doc(cfg(feature = "rt")))] 265 $item 266 )* 267 } 268 } 269 270 macro_rules! cfg_not_rt { 271 ($($item:item)*) => { 272 $( #[cfg(not(feature = "rt"))] $item )* 273 } 274 } 275 276 macro_rules! cfg_rt_multi_thread { 277 ($($item:item)*) => { 278 $( 279 #[cfg(feature = "rt-multi-thread")] 280 #[cfg_attr(docsrs, doc(cfg(feature = "rt-multi-thread")))] 281 $item 282 )* 283 } 284 } 285 286 macro_rules! cfg_not_rt_multi_thread { 287 ($($item:item)*) => { 288 $( #[cfg(not(feature = "rt-multi-thread"))] $item )* 289 } 290 } 291 292 macro_rules! cfg_test_util { 293 ($($item:item)*) => { 294 $( 295 #[cfg(feature = "test-util")] 296 #[cfg_attr(docsrs, doc(cfg(feature = "test-util")))] 297 $item 298 )* 299 } 300 } 301 302 macro_rules! cfg_not_test_util { 303 ($($item:item)*) => { 304 $( #[cfg(not(feature = "test-util"))] $item )* 305 } 306 } 307 308 macro_rules! cfg_time { 309 ($($item:item)*) => { 310 $( 311 #[cfg(feature = "time")] 312 #[cfg_attr(docsrs, doc(cfg(feature = "time")))] 313 $item 314 )* 315 } 316 } 317 318 macro_rules! cfg_not_time { 319 ($($item:item)*) => { 320 $( #[cfg(not(feature = "time"))] $item )* 321 } 322 } 323 324 macro_rules! cfg_trace { 325 ($($item:item)*) => { 326 $( 327 #[cfg(all(tokio_unstable, feature = "tracing"))] 328 #[cfg_attr(docsrs, doc(cfg(feature = "tracing")))] 329 $item 330 )* 331 } 332 } 333 334 macro_rules! cfg_not_trace { 335 ($($item:item)*) => { 336 $( 337 #[cfg(any(not(tokio_unstable), not(feature = "tracing")))] 338 $item 339 )* 340 } 341 } 342 343 macro_rules! cfg_coop { 344 ($($item:item)*) => { 345 $( 346 #[cfg(any( 347 feature = "fs", 348 feature = "io-std", 349 feature = "net", 350 feature = "process", 351 feature = "rt", 352 feature = "signal", 353 feature = "sync", 354 feature = "time", 355 ))] 356 $item 357 )* 358 } 359 } 360 361 macro_rules! cfg_not_coop { 362 ($($item:item)*) => { 363 $( 364 #[cfg(not(any( 365 feature = "fs", 366 feature = "io-std", 367 feature = "net", 368 feature = "process", 369 feature = "rt", 370 feature = "signal", 371 feature = "sync", 372 feature = "time", 373 )))] 374 $item 375 )* 376 } 377 } 378