From de3bc088cf4d2ae24c7232d500dfd69edc634ff5 Mon Sep 17 00:00:00 2001 From: RunDevelopment Date: Sun, 8 Dec 2024 16:01:26 +0100 Subject: [PATCH 1/2] Added documentation for features --- src/lib.rs | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 73a6147773f..32550de017d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,6 +4,40 @@ //! attribute and tool. Crates pull in the `#[wasm_bindgen]` attribute through //! this crate and this crate also provides JS bindings through the `JsValue` //! interface. +//! +//! ## Features +//! +//! ### `enable-interning` +//! +//! Enables the internal cache for [`wasm_bindgen::intern`]. +//! +//! ### `gg-alloc` +//! +//! Uses [`gg-allow`](https://crates.io/crates/gg-alloc) as the global allocator +//! when using `wasm-bindgen-test` to ensure that pointers outside the `i32` +//! range are handled correctly. +//! +//! ### `std` (default) +//! +//! TODO: +//! +//! ### `strict-macro` +//! +//! All warnings the `#[wasm_bindgen]` macro emits are turned into hard errors. +//! This mainly affects unused attribute options. +//! +//! ### Deprecated features +//! +//! #### `serde-serialize` +//! +//! **Deprecated:** Use the [`serde-wasm-bindgen`](https://docs.rs/serde-wasm-bindgen/latest/serde_wasm_bindgen/) crate instead. +//! +//! Enables the `JsValue::from_serde` and `JsValue::into_serde` methods for +//! serializing and deserializing Rust types to and from JavaScript. +//! +//! #### `spans` +//! +//! **Deprecated:** This feature became a no-op in wasm-bindgen v0.2.20 (Sep 7, 2018). #![no_std] #![cfg_attr( From 03215af7de6112a5713513e0e7fa0e9c8fbb03ed Mon Sep 17 00:00:00 2001 From: RunDevelopment Date: Sun, 8 Dec 2024 16:13:43 +0100 Subject: [PATCH 2/2] Done --- Cargo.toml | 4 ++-- src/lib.rs | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5feb1d22705..6333bfb45b1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,11 +32,11 @@ std = ["wasm-bindgen-macro/std", "once_cell/std"] # all unused attributes strict-macro = ["wasm-bindgen-macro/strict-macro"] -# Enables gg-alloc as system allocator when using wasm-bindgen-test to check that large pointers +# INTERNAL ONLY: Enables gg-alloc as system allocator when using wasm-bindgen-test to check that large pointers # are handled correctly gg-alloc = ["wasm-bindgen-test/gg-alloc"] -# This is only for debugging wasm-bindgen! No stability guarantees, so enable +# INTERNAL ONLY: This is only for debugging wasm-bindgen! No stability guarantees, so enable # this at your own peril! xxx_debug_only_print_generated_code = ["wasm-bindgen-macro/xxx_debug_only_print_generated_code"] diff --git a/src/lib.rs b/src/lib.rs index 32550de017d..2e36a5e5aa9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -11,15 +11,14 @@ //! //! Enables the internal cache for [`wasm_bindgen::intern`]. //! -//! ### `gg-alloc` -//! -//! Uses [`gg-allow`](https://crates.io/crates/gg-alloc) as the global allocator -//! when using `wasm-bindgen-test` to ensure that pointers outside the `i32` -//! range are handled correctly. +//! This feature currently enables the `std` feature, meaning that it is not +//! compatible with `no_std` environments. //! //! ### `std` (default) //! -//! TODO: +//! Enabling this feature will make the crate depend on the Rust standard library. +//! +//! Disable this feature to use this crate in `no_std` environments. //! //! ### `strict-macro` //!