kithara_platform/lib.rs
1//! Platform-aware primitives for native and wasm32 targets.
2//!
3//! One backend tree per configuration — `native`, `wasm`, or `flash` — is
4//! selected by the gated glob re-exports below; the backends mirror one
5//! public module tree 1:1 (`sync`, `thread`, `time`, `tokio`, …) and
6//! 100% cross-platform code lives in `common`. All crate cfg lives in this
7//! file. See the crate `CONTEXT.md` for per-target backends.
8
9// In the flash-ON lane the inert control surface (`common::flash_inert`) and
10// the real-clock arms it aliases compile but are intentionally unwired (the
11// engine `flash` module takes the path), so `unreachable_pub`/`dead_code` are
12// structurally false-positive there. OFF + wasm lanes re-export the inert
13// forms and keep full coverage. See AGENTS.md "Non-Negotiables" legalized
14#[cfg_attr(
15 all(not(target_arch = "wasm32"), feature = "flash"),
16 expect(unreachable_pub, dead_code)
17)]
18mod common;
19
20#[cfg(not(target_arch = "wasm32"))]
21// Flash-ON wraps (not re-exports) some native items: `unreachable_pub` is
22// structurally false-positive there; `dead_code` covers W1-interim unconsumed
23// arms and dies with the W2 wrappers; `unused_imports` covers pub-use items in
24// native backends that are shadowed by the flash facade arm. OFF lane keeps
25// full coverage. See AGENTS.md "Non-Negotiables" legalized exceptions.
26#[cfg_attr(feature = "flash", expect(unreachable_pub, dead_code, unused_imports))]
27mod native;
28#[cfg(all(not(target_arch = "wasm32"), not(feature = "flash")))]
29pub use native::*;
30
31#[cfg(target_arch = "wasm32")]
32mod wasm;
33#[cfg(target_arch = "wasm32")]
34pub use wasm::*;
35
36#[cfg(all(not(target_arch = "wasm32"), feature = "flash"))]
37pub mod flash;
38
39// W3 propagate-down cancel — the workspace's only cancel surface (the legacy
40// runtime-backed roots were dropped in 3.4).
41// `kithara_platform::flash::*` (macro emissions, prod attributes) must resolve
42// in every configuration: inert forms off the engine.
43#[cfg(not(all(not(target_arch = "wasm32"), feature = "flash")))]
44pub use common::flash_inert as flash;
45pub use common::{
46 cancel::{CancelGroup, CancelScope, CancelToken, CancelWakerGuard, Cancelled},
47 traits,
48};
49#[cfg(all(not(target_arch = "wasm32"), feature = "flash"))]
50pub use flash::*;