From 72bc41750247b29952f88bc731f89f2dfdc0778e Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Tue, 7 Apr 2026 16:05:47 +0200 Subject: [PATCH 1/3] Move wasm-bindgen-test-runner to CI config --- .cargo/config.toml | 3 --- .github/workflows/ci.yml | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 19bc2ee1a..a9f12423e 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,5 +1,2 @@ [alias] run-wasm = ["run", "--release", "--package", "run-wasm", "--"] - -[target.wasm32-unknown-unknown] -runner = "wasm-bindgen-test-runner" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fabd911d3..d467c5406 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -129,6 +129,8 @@ jobs: FEATURES: ${{ format(',{0}', matrix.platform.features ) }} CMD: ${{ matrix.platform.cmd }} RUSTDOCFLAGS: -Dwarnings + # Use `wasm-bindgen-cli` tooling when running wasm-bindgen tests. + CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER: wasm-bindgen-test-runner runs-on: ${{ matrix.platform.os }} steps: From 6720d3eb48b94f8ffa9e3ae23678f3e42ef35d24 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Tue, 7 Apr 2026 16:38:07 +0200 Subject: [PATCH 2/3] Use wasm-server-runner instead of cargo-run-wasm This integrates much more cleanly with Cargo, and allows people to use the guidance in their own projects without further setup. --- .cargo/config.toml | 2 -- .gitignore | 3 +++ Cargo.toml | 3 --- README.md | 15 ++++++++++++++- run-wasm/Cargo.toml | 7 ------- run-wasm/src/main.rs | 3 --- 6 files changed, 17 insertions(+), 16 deletions(-) delete mode 100644 .cargo/config.toml delete mode 100644 run-wasm/Cargo.toml delete mode 100644 run-wasm/src/main.rs diff --git a/.cargo/config.toml b/.cargo/config.toml deleted file mode 100644 index a9f12423e..000000000 --- a/.cargo/config.toml +++ /dev/null @@ -1,2 +0,0 @@ -[alias] -run-wasm = ["run", "--release", "--package", "run-wasm", "--"] diff --git a/.gitignore b/.gitignore index 2f455754f..dc931d9c5 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,6 @@ Cargo.lock /.idea /.vscode + +# Allow people to customize this for their own checkouts. +.cargo/config.toml diff --git a/Cargo.toml b/Cargo.toml index 985a54948..20a2eebb0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,3 @@ -[workspace] -members = ["run-wasm"] - [package] name = "softbuffer" version = "0.4.8" diff --git a/README.md b/README.md index f5cc40961..a07787ebe 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,20 @@ Pull requests to add support for new platforms are welcome! ## WebAssembly -To run an example with the web backend: `cargo run-wasm --example winit` +To run an example with the web backend, add the following to `.cargo/config.toml`: +```toml +[target.'cfg(target_family = "wasm")'] +runner = "wasm-server-runner" +``` + +And then run: + +```sh +cargo install wasm-server-runner +cargo run --target wasm32-unknown-unknown --example winit +``` + +And open the link to view the result in the browser. ## Android diff --git a/run-wasm/Cargo.toml b/run-wasm/Cargo.toml deleted file mode 100644 index 35dcf31dd..000000000 --- a/run-wasm/Cargo.toml +++ /dev/null @@ -1,7 +0,0 @@ -[package] -name = "run-wasm" -version = "0.1.0" -edition = "2021" - -[dependencies] -cargo-run-wasm = "0.4.0" diff --git a/run-wasm/src/main.rs b/run-wasm/src/main.rs deleted file mode 100644 index c57ab2c8c..000000000 --- a/run-wasm/src/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - cargo_run_wasm::run_wasm_cli_with_css("body { margin: 0px; }"); -} From 4a8f4ec2316ed6e5a21074837a02f5859adbcbd6 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Tue, 7 Apr 2026 16:27:24 +0200 Subject: [PATCH 3/3] Move platform-specific docs after example --- README.md | 47 ++++++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index a07787ebe..549213776 100644 --- a/README.md +++ b/README.md @@ -64,27 +64,6 @@ Beware that big endian targets are much less tested, and may behave incorrectly. Pull requests to add support for new platforms are welcome! -## WebAssembly - -To run an example with the web backend, add the following to `.cargo/config.toml`: -```toml -[target.'cfg(target_family = "wasm")'] -runner = "wasm-server-runner" -``` - -And then run: - -```sh -cargo install wasm-server-runner -cargo run --target wasm32-unknown-unknown --example winit -``` - -And open the link to view the result in the browser. - -## Android - -To run the Android-specific example on an Android phone: `cargo apk r --example winit_android` or `cargo apk r --example winit_multithread_android`. - ## Example ```rust,no_run @@ -215,6 +194,32 @@ impl ApplicationHandler for App { } ``` +## Test on WebAssembly + +To run an example with the web backend, add the following to `.cargo/config.toml`: +```toml +[target.'cfg(target_family = "wasm")'] +runner = "wasm-server-runner" +``` + +And then run: + +```sh +cargo install wasm-server-runner +cargo run --target wasm32-unknown-unknown --example winit +``` + +And open the link to view the result in the browser. + +## Test on Android + +To run the Android-specific example on an Android phone: +```sh +cargo apk r --example winit_android +# or +cargo apk r --example winit_multithread_android +``` + ## MSRV Policy This crate's Minimum Supported Rust Version (MSRV) is **1.71**. Changes to