pub(crate) fn wasm_export(item: TokenStream) -> TokenStreamExpand description
Processes an impl block, transforming methods marked with #[wasm_only].
For each marked method:
- Strips the
#[wasm_only]marker attribute - Renames the method with a
__wasm_only_prefix (e.g.subscribe->__wasm_only_subscribe) - Adds
#[wasm_bindgen(js_name = "original_name")]if nojs_nameis already present - Adds
#[doc(hidden)]to hide it from Rust documentation - Adds
#[deprecated]so it shows with strikethrough in IDE autocomplete
This makes the methods effectively unreachable from Rust (hidden, mangled name) while
preserving the original JS-facing API through wasm_bindgen’s js_name attribute.