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
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//! A generic task spawner compatible with any async runtime.
//!
//! This crate provides a [`Spawner`] type that abstracts task spawning across
//! different async runtimes without generic infection.
//!
//! # Design Philosophy
//!
//! - **Concrete type**: No generics needed in your code
//! - **Simple**: Use built-in constructors or implement [`SpawnCustom`]
//! - **Layered**: Compose middleware closures via [`CustomSpawnerBuilder`]
//! - **Flexible**: Works with any async runtime
//!
//! # Quick Start
//!
//! ## Using Tokio
//!
//! ```rust
//! # #[cfg(feature = "tokio")]
//! # #[tokio::main]
//! # async fn main() {
//! use anyspawn::Spawner;
//!
//! let spawner = Spawner::new_tokio();
//! let result = spawner.spawn(async { 1 + 1 }).await;
//! assert_eq!(result, 2);
//! # }
//! # #[cfg(not(feature = "tokio"))]
//! # fn main() {}
//! ```
//!
//! # Thread-Aware Support
//!
//! `Spawner` implements [`ThreadAware`](thread_aware::ThreadAware) and supports
//! per-core isolation via custom [`SpawnCustom`] implementations, enabling
//! contention-free, NUMA-friendly task dispatch.
//!
//! # Features
//!
//! - `tokio`: Enables the [`Spawner::new_tokio`] and
//! [`Spawner::new_tokio_with_handle`] constructors
pub use CustomSpawnerBuilder;
pub use ;
pub use JoinHandle;
pub use Spawner;
pub use ThreadAwareAsyncFnOnce;