Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions aimdb-wasm-adapter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,22 @@ aimdb-data-contracts = { version = "0.3.0", path = "../aimdb-data-contracts", de
"alloc", "aimdb-core",
] }

# Serialization (no_std + alloc)
serde = { workspace = true }
serde_json = { workspace = true }

# Async utilities (minimal, no_std compatible)
futures-util = { version = "0.3", default-features = false, features = [
"alloc",
"sink",
] }

# Bounded MPSC channel for join fan-in.
# Note: futures-channel mpsc requires "std" because its internal BiLock uses std::sync.
# The "alloc"-only path does not expose mpsc; "std" is the minimum required feature.
futures-channel = { version = "0.3", default-features = false, features = ["std", "sink"] }

[target.'cfg(target_arch = "wasm32")'.dependencies]
# WASM bindings
wasm-bindgen = { version = "0.2", optional = true }
wasm-bindgen-futures = { version = "0.4", optional = true }
Expand All @@ -56,28 +72,14 @@ web-sys = { version = "0.3", optional = true, features = [
"Window",
] }

# Serialization (no_std + alloc)
serde = { workspace = true }
serde_json = { workspace = true }
serde-wasm-bindgen = { version = "0.6", optional = true }

# Async utilities (minimal, no_std compatible)
futures-util = { version = "0.3", default-features = false, features = [
"alloc",
"sink",
] }

# Bounded MPSC channel for join fan-in.
# Note: futures-channel mpsc requires "std" because its internal BiLock uses std::sync.
# The "alloc"-only path does not expose mpsc; "std" is the minimum required feature.
futures-channel = { version = "0.3", default-features = false, features = ["std", "sink"] }

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = [
'cfg(feature, values("std"))',
] }

[dev-dependencies]
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
wasm-bindgen-test = "0.3"

# Host-only: drives the async `aimdb-core` buffer contract suite via
Expand Down
10 changes: 4 additions & 6 deletions aimdb-wasm-adapter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,12 @@ Two rules follow from how the registry is keyed:

## Target support

With `wasm-runtime` (the default) enabled this crate builds for `wasm32-*` only:
the bridge holds `web_sys` closures across await points, so its futures are
`!Send` and rely on an `unsafe impl` sound only on single-threaded wasm. A host
build stops on one `compile_error!` saying so. For the portable buffer/runtime
unit tests, drop the feature:
The default `wasm-runtime` feature enables browser integration on `wasm32`.
Native builds include the portable buffer and runtime implementations. Run their
unit tests with:

```bash
cargo test -p aimdb-wasm-adapter --no-default-features --lib
cargo test -p aimdb-wasm-adapter --lib
```

## Build
Expand Down
2 changes: 1 addition & 1 deletion aimdb-wasm-adapter/src/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ where
.map_err(|e| JsError::new(&format!("{e:?}")))?;

let callback = callback.clone();
let (cancel_token, cancel_handle) = crate::buffer::cancel_pair();
let (cancel_token, cancel_handle) = crate::cancellation::cancel_pair();

wasm_bindgen_futures::spawn_local(async move {
use core::task::Poll;
Expand Down
Loading