|
74 | 74 | //! and Node.js environments are supported, invoking the methods
|
75 | 75 | //! [described above](#supported-targets) using the [`wasm-bindgen`] toolchain.
|
76 | 76 | //!
|
| 77 | +//! To enable the `js` Cargo feature, add the following to the `dependencies` |
| 78 | +//! section in your `Cargo.toml` file: |
| 79 | +//! ```toml |
| 80 | +//! [dependencies] |
| 81 | +//! getrandom = { version = "0.2", features = ["js"] } |
| 82 | +//! ``` |
| 83 | +//! |
| 84 | +//! This can be done even if `getrandom` is not a direct dependency. Cargo |
| 85 | +//! allows crates to enable features for indirect dependencies. |
| 86 | +//! |
| 87 | +//! This feature should only be enabled for binary, test, or benchmark crates. |
| 88 | +//! Library crates should generally not enable this feature, leaving such a |
| 89 | +//! decision to *users* of their library. Also, libraries should not introduce |
| 90 | +//! their own `js` features *just* to enable `getrandom`'s `js` feature. |
| 91 | +//! |
77 | 92 | //! This feature has no effect on targets other than `wasm32-unknown-unknown`.
|
78 | 93 | //!
|
79 | 94 | //! ### Custom implementations
|
|
88 | 103 | //! using `rdrand` and `js` Cargo features) continue using their normal
|
89 | 104 | //! implementations even if a function is registered.
|
90 | 105 | //!
|
91 |
| -//! ### Indirect Dependencies |
92 |
| -//! |
93 |
| -//! If `getrandom` is not a direct dependency of your crate, you can still |
94 |
| -//! enable any of the above fallback behaviors by enabling the relevant |
95 |
| -//! feature in your root crate's `Cargo.toml`: |
96 |
| -//! ```toml |
97 |
| -//! [dependencies] |
98 |
| -//! getrandom = { version = "0.2", features = ["js"] } |
99 |
| -//! ``` |
100 |
| -//! |
101 | 106 | //! ## Early boot
|
102 | 107 | //!
|
103 | 108 | //! Sometimes, early in the boot process, the OS has not collected enough
|
|
0 commit comments