Brian Silverman | cc09f18 | 2022-03-09 15:40:20 -0800 | [diff] [blame^] | 1 | #[[ |
| 2 | ## Overview |
| 3 | |
| 4 | To build a `rust_binary` for `wasm32-unknown-unknown` target add the `--platforms=@rules_rust//rust/platform:wasm` flag. |
| 5 | |
| 6 | ```command |
| 7 | bazel build @examples//hello_world_wasm --platforms=@rules_rust//rust/platform:wasm |
| 8 | ``` |
| 9 | |
| 10 | To build a `rust_binary` for `wasm32-wasi` target add the `--platforms=@rules_rust//rust/platform:wasi` flag. |
| 11 | |
| 12 | ```command |
| 13 | bazel build @examples//hello_world_wasm --platforms=@rules_rust//rust/platform:wasi |
| 14 | ``` |
| 15 | |
| 16 | `rust_wasm_bindgen` will automatically transition to the `wasm` platform and can be used when |
| 17 | building WebAssembly code for the host target. |
| 18 | ]]# |