deno_bindgen icon indicating copy to clipboard operation
deno_bindgen copied to clipboard

Move the Rust/Deno type mapping into the Rust macro

Open andreubotella opened this issue 3 years ago • 0 comments

Currently, the deno_bindgen macro only records the exported function signatures and changes them to extern "C", with the type mapping to Deno's FFI types happening on cli.ts. This works fine for the time being, while all allowed types are numbers, but it wouldn't really work once #2 is implemented, since you would want a user to be able to use the &str type rather than having to work unsafely with *const c_char.

Moving the Rust/Deno type mapping to the macro would also make it possible to show "type not supported" errors highlighted in context, as per usual with rustc.

andreubotella avatar Aug 26 '21 06:08 andreubotella