Skip to content

Commit f6ddd51

Browse files
authored
Add .cargo/config.toml example (#591)
1 parent 2bb3959 commit f6ddd51

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

README.md

+8-3
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,14 @@ of randomness based on their specific needs:
8686
| `custom` | All targets | `*` | User-provided custom implementation (see [custom backend])
8787

8888
Opt-in backends can be enabled using the `getrandom_backend` configuration flag.
89-
The flag can be set either by specifying the `rustflags` field in
90-
[`.cargo/config.toml`] (note that it can be done on a per-target basis), or by using
91-
the `RUSTFLAGS` environment variable:
89+
The flag can be set either by specifying the `rustflags` field in [`.cargo/config.toml`]:
90+
```toml
91+
# It's recommended to set the flag on a per-target basis:
92+
[target.wasm32-unknown-unknown]
93+
rustflags = ['--cfg', 'getrandom_backend="wasm_js"']
94+
```
95+
96+
Or by using the `RUSTFLAGS` environment variable:
9297

9398
```sh
9499
RUSTFLAGS='--cfg getrandom_backend="linux_getrandom"' cargo build

0 commit comments

Comments
 (0)