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
//! `spawns-compat` provides functions to find async runtimes for spawning task.
//!
//! It uses [linkme] to inject these functions to `spawns-core`. In some platforms, this crate may
//! not be linked to binary finally. So, you may have to speak explicitly about this with `extern
//! crate spawns_compat`. You could also use it with `spawns-core` through `spawns` which does so
//! for you. Besides this, in macOS, you may have to put below to your `Cargo.toml`.
//!
//! ```toml
//! [profile.dev]
//! lto = "thin"
//! ```
//!
//! See for details:
//! * <https://stackoverflow.com/questions/29403920/whats-the-difference-between-use-and-extern-crate/29404692#29404692>
//! * <https://github.com/dtolnay/linkme/issues/31>
//! * <https://github.com/dtolnay/linkme/issues/61>

#[cfg(feature = "smol")]
mod smol;
#[cfg(feature = "tokio")]
mod tokio;

#[cfg(feature = "async-global-executor")]
mod async_global_executor;

#[cfg(test)]
mod tests {
    #[test]
    #[cfg(all(feature = "async-global-executor", feature = "smol"))]
    #[should_panic(expected = "multiple global spawners")]
    fn multiple_global() {
        spawns_core::spawn(async move {});
    }
}