dcSpark / cardano-multiplatform-lib

Rust implementation of Cardano
MIT License
99 stars 36 forks source link

Remove wasm-bindgen deps from rust #343

Closed rooooooooob closed 4 months ago

rooooooooob commented 4 months ago

Rust CML crates must use wasm-bindgen for enums as these are used from the WASM CML crates.

Using noop_proc_macro we can replace the wasm_bindgen proc macro with a no-op that does nothing when consumed directly from rust.

This is now locked behind a feature (used_from_wasm) as we can't just use cfg target checks as compiling the wasm crate (not using web-pack) would use the rust target and break.

Crates using cml-chain and cml-multi-era from a wasm crate must specify this feature to activate the wasm_bindgen dependancy instead of the no-op macro.