Closed
Description
Currently when you export a struct in Rust to JS it only exports public methods, but we should enable the ability to define getters and setters for properties too, for example:
#[wasm_bindgen]
struct Foo { /* ... */ }
#[wasm_bindgen]
impl Foo {
pub fn new() -> Foo { ... }
#[wasm_bindgen(getter)]
pub fn field1(&self) -> u32 { ... }
#[wasm_bindgen(setter)]
pub fn set_field1(&mut self, f: u32) { ... }
#[wasm_bindgen(getter = anotherName)]
pub fn another_name(&self) { ... }
#[wasm_bindgen(setter = anotherName)]
pub fn set_another_name(&mut self, param: u32) { ... }
}
Metadata
Metadata
Assignees
Labels
No labels