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