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
//! A shared, tokio-free async runtime for napi-rs addons.
//!
//! Two layers, one crate:
//!
//! - **Scheduler** (always compiled, napi-free): a pluggable async/CPU/blocking
//! scheduler with a MultiThread flavor (Rayon-backed worker pool on native
//! targets and on `wasm32-wasip1-threads`) and a CurrentThread flavor
//! (host-driven turns; the only flavor on threadless WebAssembly targets).
//! Exposed at the crate root: [`spawn`], [`spawn_blocking`],
//! [`block_on`], [`sleep_until`], [`configure`], [`start`], [`shutdown`],
//! the host driver SPIs ([`CurrentThreadTaskDriver`], [`TimerDriver`]), and
//! the metrics/introspection helpers.
//! - **napi adapter** (feature `napi`, on by default): an
//! `unsafe impl AsyncRuntime` backend for napi-rs' `async-runtime` SPI plus
//! the JavaScript-facing host protocol (`registerCurrentThreadTaskHost`,
//! `registerTimerHost`, config/metrics exports). Hosts call [`install`] from
//! their own `#[napi_derive::module_init]` hook after resolving their
//! runtime configuration; this crate deliberately ships no `module_init` of
//! its own.
/// Maximum number of physical workers a scheduler owned by this crate may
/// create.
pub const MAX_ASYNC_RUNTIME_WORKER_THREADS: usize = 256;
/// Platform-realizable worker ceiling after applying this crate's production
/// cap.
///
/// On `wasm32-wasip1-threads` Rayon reports 255 (`THREADS_BITS = 8` on 32-bit),
/// so this returns 255 there rather than the native cap of 256.
/// Threadless WebAssembly builds (`wasm32-wasip1`, `wasm32-unknown-unknown`)
/// use the current-thread executor and can never create a worker.
pub const
pub use *;
pub use *;