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_aio { 49 ($($item:item)*) => { 50 $( 51 #[cfg(all(any(docsrs, target_os = "freebsd"), feature = "net"))] 52 #[cfg_attr(docsrs, 53 doc(cfg(all(target_os = "freebsd", feature = "net"))) 54 )] 55 $item 56 )* 57 } 58 } 59 60 macro_rules! cfg_fs { 61 ($($item:item)*) => { 62 $( 63 #[cfg(feature = "fs")] 64 #[cfg_attr(docsrs, doc(cfg(feature = "fs")))] 65 $item 66 )* 67 } 68 } 69 70 macro_rules! cfg_io_blocking { 71 ($($item:item)*) => { 72 $( #[cfg(any(feature = "io-std", feature = "fs"))] $item )* 73 } 74 } 75 76 macro_rules! cfg_io_driver { 77 ($($item:item)*) => { 78 $( 79 #[cfg(any( 80 feature = "net", 81 feature = "process", 82 all(unix, feature = "signal"), 83 ))] 84 #[cfg_attr(docsrs, doc(cfg(any( 85 feature = "net", 86 feature = "process", 87 all(unix, feature = "signal"), 88 ))))] 89 $item 90 )* 91 } 92 } 93 94 macro_rules! cfg_io_driver_impl { 95 ( $( $item:item )* ) => { 96 $( 97 #[cfg(any( 98 feature = "net", 99 feature = "process", 100 all(unix, feature = "signal"), 101 ))] 102 $item 103 )* 104 } 105 } 106 107 macro_rules! cfg_not_io_driver { 108 ($($item:item)*) => { 109 $( 110 #[cfg(not(any( 111 feature = "net", 112 feature = "process", 113 all(unix, feature = "signal"), 114 )))] 115 $item 116 )* 117 } 118 } 119 120 macro_rules! cfg_io_readiness { 121 ($($item:item)*) => { 122 $( 123 #[cfg(feature = "net")] 124 $item 125 )* 126 } 127 } 128 129 macro_rules! cfg_io_std { 130 ($($item:item)*) => { 131 $( 132 #[cfg(feature = "io-std")] 133 #[cfg_attr(docsrs, doc(cfg(feature = "io-std")))] 134 $item 135 )* 136 } 137 } 138 139 macro_rules! cfg_io_util { 140 ($($item:item)*) => { 141 $( 142 #[cfg(feature = "io-util")] 143 #[cfg_attr(docsrs, doc(cfg(feature = "io-util")))] 144 $item 145 )* 146 } 147 } 148 149 macro_rules! cfg_not_io_util { 150 ($($item:item)*) => { 151 $( #[cfg(not(feature = "io-util"))] $item )* 152 } 153 } 154 155 macro_rules! cfg_loom { 156 ($($item:item)*) => { 157 $( #[cfg(loom)] $item )* 158 } 159 } 160 161 macro_rules! cfg_not_loom { 162 ($($item:item)*) => { 163 $( #[cfg(not(loom))] $item )* 164 } 165 } 166 167 macro_rules! cfg_macros { 168 ($($item:item)*) => { 169 $( 170 #[cfg(feature = "macros")] 171 #[cfg_attr(docsrs, doc(cfg(feature = "macros")))] 172 $item 173 )* 174 } 175 } 176 177 macro_rules! cfg_stats { 178 ($($item:item)*) => { 179 $( 180 #[cfg(all(tokio_unstable, feature = "stats"))] 181 #[cfg_attr(docsrs, doc(cfg(feature = "stats")))] 182 $item 183 )* 184 } 185 } 186 187 macro_rules! cfg_not_stats { 188 ($($item:item)*) => { 189 $( 190 #[cfg(not(all(tokio_unstable, feature = "stats")))] 191 $item 192 )* 193 } 194 } 195 196 macro_rules! cfg_net { 197 ($($item:item)*) => { 198 $( 199 #[cfg(feature = "net")] 200 #[cfg_attr(docsrs, doc(cfg(feature = "net")))] 201 $item 202 )* 203 } 204 } 205 206 macro_rules! cfg_net_unix { 207 ($($item:item)*) => { 208 $( 209 #[cfg(all(unix, feature = "net"))] 210 #[cfg_attr(docsrs, doc(cfg(all(unix, feature = "net"))))] 211 $item 212 )* 213 } 214 } 215 216 macro_rules! cfg_net_windows { 217 ($($item:item)*) => { 218 $( 219 #[cfg(all(any(all(doc, docsrs), windows), feature = "net"))] 220 #[cfg_attr(docsrs, doc(cfg(all(windows, feature = "net"))))] 221 $item 222 )* 223 } 224 } 225 226 macro_rules! cfg_process { 227 ($($item:item)*) => { 228 $( 229 #[cfg(feature = "process")] 230 #[cfg_attr(docsrs, doc(cfg(feature = "process")))] 231 #[cfg(not(loom))] 232 $item 233 )* 234 } 235 } 236 237 macro_rules! cfg_process_driver { 238 ($($item:item)*) => { 239 #[cfg(unix)] 240 #[cfg(not(loom))] 241 cfg_process! { $($item)* } 242 } 243 } 244 245 macro_rules! cfg_not_process_driver { 246 ($($item:item)*) => { 247 $( 248 #[cfg(not(all(unix, not(loom), feature = "process")))] 249 $item 250 )* 251 } 252 } 253 254 macro_rules! cfg_signal { 255 ($($item:item)*) => { 256 $( 257 #[cfg(feature = "signal")] 258 #[cfg_attr(docsrs, doc(cfg(feature = "signal")))] 259 #[cfg(not(loom))] 260 $item 261 )* 262 } 263 } 264 265 macro_rules! cfg_signal_internal { 266 ($($item:item)*) => { 267 $( 268 #[cfg(any(feature = "signal", all(unix, feature = "process")))] 269 #[cfg(not(loom))] 270 $item 271 )* 272 } 273 } 274 275 macro_rules! cfg_not_signal_internal { 276 ($($item:item)*) => { 277 $( 278 #[cfg(any(loom, not(unix), not(any(feature = "signal", all(unix, feature = "process")))))] 279 $item 280 )* 281 } 282 } 283 284 macro_rules! cfg_sync { 285 ($($item:item)*) => { 286 $( 287 #[cfg(feature = "sync")] 288 #[cfg_attr(docsrs, doc(cfg(feature = "sync")))] 289 $item 290 )* 291 } 292 } 293 294 macro_rules! cfg_not_sync { 295 ($($item:item)*) => { 296 $( #[cfg(not(feature = "sync"))] $item )* 297 } 298 } 299 300 macro_rules! cfg_rt { 301 ($($item:item)*) => { 302 $( 303 #[cfg(feature = "rt")] 304 #[cfg_attr(docsrs, doc(cfg(feature = "rt")))] 305 $item 306 )* 307 } 308 } 309 310 macro_rules! cfg_not_rt { 311 ($($item:item)*) => { 312 $( #[cfg(not(feature = "rt"))] $item )* 313 } 314 } 315 316 macro_rules! cfg_rt_multi_thread { 317 ($($item:item)*) => { 318 $( 319 #[cfg(feature = "rt-multi-thread")] 320 #[cfg_attr(docsrs, doc(cfg(feature = "rt-multi-thread")))] 321 $item 322 )* 323 } 324 } 325 326 macro_rules! cfg_not_rt_multi_thread { 327 ($($item:item)*) => { 328 $( #[cfg(not(feature = "rt-multi-thread"))] $item )* 329 } 330 } 331 332 macro_rules! cfg_test_util { 333 ($($item:item)*) => { 334 $( 335 #[cfg(feature = "test-util")] 336 #[cfg_attr(docsrs, doc(cfg(feature = "test-util")))] 337 $item 338 )* 339 } 340 } 341 342 macro_rules! cfg_not_test_util { 343 ($($item:item)*) => { 344 $( #[cfg(not(feature = "test-util"))] $item )* 345 } 346 } 347 348 macro_rules! cfg_time { 349 ($($item:item)*) => { 350 $( 351 #[cfg(feature = "time")] 352 #[cfg_attr(docsrs, doc(cfg(feature = "time")))] 353 $item 354 )* 355 } 356 } 357 358 macro_rules! cfg_not_time { 359 ($($item:item)*) => { 360 $( #[cfg(not(feature = "time"))] $item )* 361 } 362 } 363 364 macro_rules! cfg_trace { 365 ($($item:item)*) => { 366 $( 367 #[cfg(all(tokio_unstable, feature = "tracing"))] 368 #[cfg_attr(docsrs, doc(cfg(feature = "tracing")))] 369 $item 370 )* 371 } 372 } 373 374 macro_rules! cfg_not_trace { 375 ($($item:item)*) => { 376 $( 377 #[cfg(any(not(tokio_unstable), not(feature = "tracing")))] 378 $item 379 )* 380 } 381 } 382 383 macro_rules! cfg_coop { 384 ($($item:item)*) => { 385 $( 386 #[cfg(any( 387 feature = "fs", 388 feature = "io-std", 389 feature = "net", 390 feature = "process", 391 feature = "rt", 392 feature = "signal", 393 feature = "sync", 394 feature = "time", 395 ))] 396 $item 397 )* 398 } 399 } 400 401 macro_rules! cfg_not_coop { 402 ($($item:item)*) => { 403 $( 404 #[cfg(not(any( 405 feature = "fs", 406 feature = "io-std", 407 feature = "net", 408 feature = "process", 409 feature = "rt", 410 feature = "signal", 411 feature = "sync", 412 feature = "time", 413 )))] 414 $item 415 )* 416 } 417 } 418 419 macro_rules! cfg_has_atomic_u64 { 420 ($($item:item)*) => { 421 $( 422 #[cfg(not(any( 423 target_arch = "arm", 424 target_arch = "mips", 425 target_arch = "powerpc" 426 )))] 427 $item 428 )* 429 } 430 } 431 432 macro_rules! cfg_not_has_atomic_u64 { 433 ($($item:item)*) => { 434 $( 435 #[cfg(any( 436 target_arch = "arm", 437 target_arch = "mips", 438 target_arch = "powerpc" 439 ))] 440 $item 441 )* 442 } 443 } 444