Skip to content

Commit

Permalink
Add .cargo/config.toml example
Browse files Browse the repository at this point in the history
  • Loading branch information
newpavlov authored Jan 28, 2025
1 parent 2bb3959 commit 1e94c23
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,14 @@ of randomness based on their specific needs:
| `custom` | All targets | `*` | User-provided custom implementation (see [custom backend])

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

Or by using the `RUSTFLAGS` environment variable:

```sh
RUSTFLAGS='--cfg getrandom_backend="linux_getrandom"' cargo build
Expand Down

0 comments on commit 1e94c23

Please sign in to comment.