book
book copied to clipboard
Additional clarity would be helpful in section 4.4 defining the Universe struct
Along with several other people, I at first missed the #[wasm_bindgen] decorator above the definition of the Universe struct, and then encountered a very confusing error on the #[wasm_bingen] decorator above the impl Universe block for the public functions.
I propose a change to 4.4 rust implementation that looks something like this

Where before it simply said this

I am not sure of exactly the right thing to say there, so "We also need to let wasm_bindgen know about this struct so we'll again include the decorator" is just a placeholder. But something like it, I think, would be helpful and save a few people a headache.
@apc518 I also ran into this issue, and think that your changes would be a nice improvement.
Additionally, we may want to add the #[wasm_bindgen] decorator above the first impl Universe block. As using this as a starting point is where I first missed the decorator.
