Motivation
Right now you can use js_name to convert a Rust foo_bar into JS fooBar (or vice versa). But 99% of the time you want it to be camel case, so this just ends up being repetitive boilerplate:
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(js_name = fooBar)]
fn foo_bar(...);
#[wasm_bindgen(js_name = quxCorge)]
fn qux_corge(...);
#[wasm_bindgen(js_name = yesNo)]
fn yes_no(...);
}
Proposed Solution
wasm-bindgen should automatically camelify JS names, so foo_bar will be translated into fooBar on import/export.
It will still be possible to use js_name to manually override that if the user does not want camel-case.
This is a breaking change, so we should batch it together with other breaking changes.
Motivation
Right now you can use
js_nameto convert a Rustfoo_barinto JSfooBar(or vice versa). But 99% of the time you want it to be camel case, so this just ends up being repetitive boilerplate:Proposed Solution
wasm-bindgen should automatically camelify JS names, so
foo_barwill be translated intofooBaron import/export.It will still be possible to use
js_nameto manually override that if the user does not want camel-case.This is a breaking change, so we should batch it together with other breaking changes.