Files
SpacetimeDB/sdks/rust/Cargo.toml
Zeke Foppa 10a4779b13 wasm support for Rust SDK (#4183)
# Description of Changes

This PR adapts the Rust SDK test suite to work with the wasm version
added in https://github.com/clockworklabs/SpacetimeDB/pull/4089 (which
I've closed in favor of this PR).

Most of the changes revolve around wasm's different async semantics -
everything runs in one thread, so things that relied on background
threads didn't work directly. Several tests would lock up because
something in them blocked synchronously, which blocked any background
work from progressing.

We moved the test-clients contents into a `test_handlers.rs` so that it
could be called from both `main` (for native tests) and `lib` (for wasm
tests). To show what actually changed, use:
```bash
git diff --no-index -- <(git show origin/master:sdks/rust/tests/procedure-client/src/main.rs) sdks/rust/tests/procedure-client/src/test_handlers.rs
```
(or similar for other test-clients)

# API and ABI breaking changes

None, I think/hope.

# Expected complexity level and risk

2

# Testing

- [x] I've augmented the CI to also run the test suite with the `web`
feature

---------

Signed-off-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
Co-authored-by: Thales R <thlsrmsdev@gmail.com>
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2026-03-23 01:27:51 +00:00

82 lines
2.5 KiB
TOML

[package]
name = "spacetimedb-sdk"
version.workspace = true
edition.workspace = true
license-file = "LICENSE"
description = "A Rust SDK for clients to interface with SpacetimeDB"
rust-version.workspace = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
default = []
allow_loopback_http_for_tests = ["spacetimedb-testing/allow_loopback_http_for_tests"]
browser = [
"dep:getrandom",
"dep:gloo-console",
"dep:gloo-net",
"dep:gloo-storage",
"dep:gloo-utils",
"dep:js-sys",
"dep:tokio-tungstenite-wasm",
"dep:wasm-bindgen",
"dep:wasm-bindgen-futures",
"dep:web-sys",
]
[dependencies]
spacetimedb-data-structures.workspace = true
spacetimedb-sats.workspace = true
spacetimedb-lib = { workspace = true, features = ["serde", "metrics_impls"]}
spacetimedb-client-api-messages.workspace = true
spacetimedb-metrics.workspace = true
spacetimedb-query-builder.workspace = true
spacetimedb-schema.workspace = true
thiserror.workspace = true
anymap3 = "1.0.1"
base64.workspace = true
brotli.workspace = true
bytes.workspace = true
flate2.workspace = true
futures.workspace = true
futures-channel.workspace = true
http.workspace = true
log.workspace = true
once_cell.workspace = true
prometheus.workspace = true
rand.workspace = true
getrandom = { version = "0.3.4", features = ["wasm_js"], optional = true }
gloo-console = { version = "0.3.0", optional = true }
gloo-net = { version = "0.6.0", optional = true }
gloo-storage = { version = "0.3.0", optional = true }
gloo-utils = { version = "0.2.0", optional = true }
js-sys = { version = "0.3", optional = true }
tokio-tungstenite-wasm = { version = "0.6.0", optional = true }
wasm-bindgen = { version = "0.2.100", optional = true }
wasm-bindgen-futures = { version = "0.4.45", optional = true }
web-sys = { version = "0.3.77", features = ["HtmlDocument"], optional = true }
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
home.workspace = true
tokio.workspace = true
tokio-tungstenite.workspace = true
# native-tls 0.2.17 fails to compile with Rust 1.93.0 due non-exhaustive
# matching in upstream code. Pin until upstream ships a compatible release.
native-tls = "=0.2.14"
[dev-dependencies]
# for quickstart-chat and cursive-chat examples
hex.workspace = true
# for cursive-chat example
cursive.workspace = true
futures-channel.workspace = true
shlex = "1.3.0"
# for tests
spacetimedb-testing = { path = "../../crates/testing" }
[lints]
workspace = true