One limitation of Rust macro is that it can only access code token, not actual type information.
When macro sees a type `X` macro can never be sure whether it's `&str` as Rust allows type alias. If `X` is not `&str` it may also be a struct that contains `&str`, still macro cannot know.
Wasm-bindgen workarounds this issue by generating "fake functions" then read and remove them in CLI:
One limitation of Rust macro is that it can only access code token, not actual type information.
When macro sees a type `X` macro can never be sure whether it's `&str` as Rust allows type alias. If `X` is not `&str` it may also be a struct that contains `&str`, still macro cannot know.
Wasm-bindgen workarounds this issue by generating "fake functions" then read and remove them in CLI:
https://wasm-bindgen.github.io/wasm-bindgen/contributing/des...
Zig comptime allows getting full type information. This is one advantage of Zig.