@@ -47,19 +47,24 @@ usually builds with the feature off.
47
47
Some packages want to support both [ ` no_std ` ] and ` std ` environments. This is
48
48
useful for supporting embedded and resource-constrained platforms, but still
49
49
allowing extended capabilities for platforms that support the full standard
50
- library. The [ ` memchr ` ] package defines a [ ` std ` feature] that is [ enabled by
51
- default] [ memchr-default ] . At the top of the library, it [ conditionally enables
52
- the ` no_std ` attribute] [ memchr-nostd ] . Then, in various places in the code, it
53
- uses ` #[cfg(feature = "std")] ` attributes to conditionally enable extra
54
- functionality. For example, when ` std ` is enabled, it can do [ runtime CPU
55
- feature detection] .
50
+ library.
51
+
52
+ The [ ` wasm-bindgen ` ] package defines a [ ` std ` feature] [ wasm-bindgen-std ] that
53
+ is [ enabled by default] [ wasm-bindgen-default ] . At the top of the library, it
54
+ [ unconditionally enables the ` no_std ` attribute] [ wasm-bindgen-no_std ] . This
55
+ ensures that ` std ` and the [ ` std ` prelude] are not automatically in scope.
56
+ Then, in various places in the code ([ example1] [ wasm-bindgen-cfg1 ] ,
57
+ [ example2] [ wasm-bindgen-cfg2 ] ), it uses ` #[cfg(feature = "std")] ` attributes
58
+ to conditionally enable extra functionality that requires ` std ` .
56
59
57
60
[ `no_std` ] : ../../reference/crates-and-source-files.html#preludes-and-no_std
58
- [ `memchr` ] : https://crates.io/crates/memchr
59
- [ `std` feature ] : https://github.com/BurntSushi/rust-memchr/blob/2.3.4/Cargo.toml#L21-L25
60
- [ memchr-default ] : https://github.com/BurntSushi/rust-memchr/blob/2.3.4/Cargo.toml#L19
61
- [ memchr-nostd ] : https://github.com/BurntSushi/rust-memchr/blob/2.3.4/src/lib.rs#L23
62
- [ runtime CPU feature detection ] : https://github.com/BurntSushi/rust-memchr/blob/2.3.4/src/x86/mod.rs#L62-L66
61
+ [ `wasm-bindgen` ] : https://crates.io/crates/wasm-bindgen
62
+ [ `std` prelude ] : ../../std/prelude/index.html
63
+ [ wasm-bindgen-std ] : https://github.com/rustwasm/wasm-bindgen/blob/0.2.69/Cargo.toml#L25
64
+ [ wasm-bindgen-default ] : https://github.com/rustwasm/wasm-bindgen/blob/0.2.69/Cargo.toml#L23
65
+ [ wasm-bindgen-no_std ] : https://github.com/rustwasm/wasm-bindgen/blob/0.2.69/src/lib.rs#L8
66
+ [ wasm-bindgen-cfg1 ] : https://github.com/rustwasm/wasm-bindgen/blob/0.2.69/src/lib.rs#L270-L273
67
+ [ wasm-bindgen-cfg2 ] : https://github.com/rustwasm/wasm-bindgen/blob/0.2.69/src/lib.rs#L67-L75
63
68
64
69
### Re-exporting dependency features
65
70
0 commit comments