wasm_bindgen_x/lib.rs
1//! Unified wasm-bindgen shim crate
2//!
3//! This crate transparently re-exports either:
4//! - wry-bindgen-core for desktop targets (non-wasm32)
5//! - wasm-bindgen for wasm32 targets
6//!
7//! The `#[wasm_bindgen]` macro is a shim that expands to both implementations
8//! wrapped in cfg-conditional modules.
9
10#![no_std]
11#![allow(hidden_glob_reexports)]
12
13// Re-export the shim macro (works for both targets)
14pub use wasm_bindgen_macro::__wasm_bindgen_class_marker;
15pub use wasm_bindgen_macro::link_to;
16pub use wasm_bindgen_macro::wasm_bindgen;
17
18#[cfg(not(target_arch = "wasm32"))]
19pub use wry_bindgen::*;
20
21#[cfg(target_arch = "wasm32")]
22pub use wasm_bindgen::*;
23
24// Re-export the upstream wasm_bindgen macro for wasm32 targets
25// This is used by the shim macro to delegate to the real wasm-bindgen
26#[cfg(target_arch = "wasm32")]
27pub use wasm_bindgen::prelude::wasm_bindgen as __wasm_bindgen_upstream_macro;
28
29// Re-export the upstream class marker for wasm32 targets
30#[cfg(target_arch = "wasm32")]
31pub use wasm_bindgen::prelude::__wasm_bindgen_class_marker as __wasm_bindgen_upstream_class_marker;