From 1e94c23215b577f1597a6d744caaa493100de68a Mon Sep 17 00:00:00 2001 From: Artyom Pavlov Date: Tue, 28 Jan 2025 18:44:16 +0300 Subject: [PATCH] Add .cargo/config.toml example --- README.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0007634c..a3f2dce0 100644 --- a/README.md +++ b/README.md @@ -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